iPixel Posted September 5, 2008 Share Posted September 5, 2008 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. Quote Link to comment Share on other sites More sharing options...
web_loone_08 Posted September 10, 2008 Share Posted September 10, 2008 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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.