Jump to content

Why wont my layers display....


iPixel

Recommended Posts

I've been staring at this and cant see why my layers  (layer1 & layer2) refuse to display.

 

The script checks for flash plugin... and depending on the plugin it choses which layer to display.

 

<html>
<head>
<title>FLASH DETECTOR</title>
<style type="text/css">
#layer1 /* FLASH LAYER */
{
display:none;
}
#layer2 /* STATIC LAYER */
{
display:none;
}
</style>
<SCRIPT LANGUAGE=JavaScript1.1>
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i < words.length; ++i)
    {
	if (isNaN(parseInt(words[i])))
	continue;
	var MM_PluginVersion = words[i]; 
    }
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
document.getElementById('layer1').display="block";	// FAILS HERE
alert("Layer 1 Showing");
} else{
document.getElementById('layer2').display="block";
alert("Layer 2 Showing");
}
</SCRIPT>

</head>
<body>
<div id="layer1"> FLASH LAYER </div>
<div id="layer2"> STATIC LAYER </div>
</body>
</html>

 

and i've tried saying ...layer1).style.display="block"; that did not work either.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/122901-why-wont-my-layers-display/
Share on other sites

try this:

 

<html>
<head>
<title>FLASH DETECTOR</title>
<style type="text/css">
#layer1 /* FLASH LAYER */
{
display:none;
}
#layer2 /* STATIC LAYER */
{
display:none;
}
</style>
<SCRIPT LANGUAGE=JavaScript1.1>
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i < words.length; ++i)
    {
	if (isNaN(parseInt(words[i])))
	continue;
	var MM_PluginVersion = words[i]; 
    }
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}

function check() {
if (MM_FlashCanPlay == true) {
document.getElementById("layer1").style.display="block";
alert("Layer 1 Showing");
} else{
document.getElementById("layer2").style.display="block";
alert("Layer 2 Showing");
}
}
window.onload = function() {
check();
}
</SCRIPT>

</head>
<body>
<div id="layer1"> FLASH LAYER </div>
<div id="layer2"> STATIC LAYER </div>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.