I have downloaded the Flash Detection javascript provided by Kirupa for redirection to a Flash or NonFlash page. This works fine. I am trying to modify the javascript so that it will detect and play the Flash movie if the Flash player is found - or play a .NET Ajax slideshow if Flash Player is not found. Both controls are located on the same page as the Flash Detection javascript.
The Flash video and .NET Slideshow are each in their own DIVs at the same location on the page. I want the javascript to toggle between the visibility styles for the two Divs based on Flash Detection. The Div Ids are “Flashdiv” and NETslideshowdiv". The following javascript does not seem to be able to change the Div visibililty. Any suggestions for how to get this to work? Thanks in advance for any help provided and thanks to Kirupa for making the original script available.
<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*)))
continue;
var MM_PluginVersion = words*;
}
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>
'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next
');
document.write(‘MM_FlashCanPlay = ( IsObject(CreateObject(“ShockwaveFlash.ShockwaveFlash.” & MM_contentVersion)))
‘);
document.write(’</SCR’ + 'IPT>
');
}
if ( MM_FlashCanPlay ) {
document.getElementById(“Flashdiv”).style.visibility = “visible”;
document.getElementById(“NETslideshowdiv”).style.visibility = “hidden”;
} else{
document.getElementById(“NETslideshowdiv”).style.visibility = “visible”;
document.getElementById(“Flashdiv”).style.visibility = “hidden”;
}
//–>
</SCRIPT>