taya74
07-27-2008, 09:31 AM
I know how to do a basic external Javascript (and don't know much about Javascript) but can't work out how to do it for the Flash Detection Code - I presume all the coding in the head for it goes into a txt file saved as external.js and then the following replaces it
<SCRIPT language="JavaScript" SRC="external.js"></SCRIPT>
But what about the code in the body - I presume this stays in the body but how do I point that code to the external.js (I have 2 flash files in the one page as well but will have the same flash detection coding) ie
<script language="JavaScript" type="text/javascript">
<!--
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable version
var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
+ 'width="742" height="121"'
+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
+ '<param name="movie" value="perthsky.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#333333" />'
+ '<embed src="perthsky.swf" quality="high" bgcolor="#333333" '
+ 'width="742" height="121" name="perthsky" align="middle"'
+ 'play="true"'
+ 'loop="false"'
+ 'quality="high"'
+ 'allowScriptAccess="sameDomain"'
+ 'type="application/x-shockwave-flash"'
+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
+ '<\/embed>'
+ '<\/object>';
document.write(oeTags); // embed the flash movie
} else { // flash is too old or we can't detect the plugin
var alternateContent = '<img src="perthcitypano2.jpg" />';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
Thanks
<SCRIPT language="JavaScript" SRC="external.js"></SCRIPT>
But what about the code in the body - I presume this stays in the body but how do I point that code to the external.js (I have 2 flash files in the one page as well but will have the same flash detection coding) ie
<script language="JavaScript" type="text/javascript">
<!--
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable version
var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
+ 'width="742" height="121"'
+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
+ '<param name="movie" value="perthsky.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#333333" />'
+ '<embed src="perthsky.swf" quality="high" bgcolor="#333333" '
+ 'width="742" height="121" name="perthsky" align="middle"'
+ 'play="true"'
+ 'loop="false"'
+ 'quality="high"'
+ 'allowScriptAccess="sameDomain"'
+ 'type="application/x-shockwave-flash"'
+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
+ '<\/embed>'
+ '<\/object>';
document.write(oeTags); // embed the flash movie
} else { // flash is too old or we can't detect the plugin
var alternateContent = '<img src="perthcitypano2.jpg" />';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
Thanks