Text file of source used in Playing Background Music 2 ( js-bgs2.htm ) <HTML> <HEAD> <TITLE> Playing Background Music 2 </TITLE> <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- Activate Cloaking Device //*************************************************************** // Playing Background Music 2 // by Tim Wallace (timothy@essex1.com) // // Copyright (C)1997 Timothy Wallace. All Rights Reserved. //*************************************************************** var browser_check=""; if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>=3) browser_check="n3_or_better"; if(navigator.appName.substring(0,9)=="Microsoft") browser_check="msie"; function playSound() { if (browserTest() && osTest() && javaTest() && readyTest()) document.player.play(true,'js-bgs2.mid'); } function stopSound() { if (browserTest() && osTest() && javaTest() && readyTest()) document.player.stop(); } function browserTest() { if(browser_check=="n3_or_better") return true; else { alert("\nThis control requires Netscape 3.0 or better."); return false; } } function osTest() { if(navigator.appVersion.indexOf("68k") == -1) return true; else { alert("\nBe fore-warned, I understand that a Mac may have problems with LiveAudio."); return true; } } function javaTest() { if(navigator.javaEnabled()) return true; else { alert("\nYou must enable java for this scheme to work."); return false; } } function readyTest() { if(document.player.IsReady()) return true; else { alert("\nPlayer was not ready... try again."); return false; } } // Called by View Source button - displays text file of source. function viewSource() { alert("\nA text file with source will be loaded to the full window.\n\nUse your browser BACK button to return to the examples."); top.window.location.href="js-bgs2.txt"; } // Called by About This button function about() { msg1="This example features the following:"; msg2="- embeds player for Netscape 3 or better only"; msg3="- plays song with bgsound for MSIE"; msg4="- checks for correct browser before playing"; msg5="- checks for Macintosh OS before playing"; msg6="- checks if java is enabled before loading & playing"; msg7="- checks if player is ready before playing"; msg8="- uses javascript to start/stop the player"; alert("\n"+msg1+"\n\n "+msg2+"\n "+msg3+"\n\n "+msg4+"\n "+msg5+"\n "+msg6+"\n "+msg7+"\n\n "+msg8+"\n\n"); } // Deactivate Cloaking --> </SCRIPT> </HEAD> <BODY BGCOLOR="#00FFFF"> <CENTER><STRONG><EM> <FONT COLOR="#800000" SIZE=+3>Playing Background Music 2</FONT> </EM></STRONG></CENTER> <BR><BR> <CENTER> <FONT COLOR=000000 SIZE="+1">Control LiveAudio with javascript... </FONT> <BR><BR> <FONT COLOR=000000 SIZE="+0">(reworked October 18, 1997)</FONT> <BR><BR> <FONT COLOR=0000ff SIZE="+1"><U>Netscape 3.0 or better required</U></FONT> </CENTER> <BR><BR> <CENTER><FORM><TABLE BORDER="4"><TR> <TD><INPUT TYPE="button" VALUE=" PLAY " onClick="playSound()"></TD> <TD><INPUT TYPE="button" VALUE=" STOP " onClick="stopSound()"></TD> </TR></TABLE></FORM></CENTER> <BR> <CENTER><FORM> <TABLE BORDER="0" WIDTH="400"><TR> <TD ALIGN="center" WIDTH="200"> <INPUT TYPE="button" VALUE="View Source" onClick="viewSource()"> </TD><TD ALIGN="center" WIDTH="200"> <INPUT TYPE="button" VALUE=" About This " onClick="about()"> </TD></TR></TABLE> </FORM></CENTER> <BR> <HR WIDTH=200 ALIGN=center SIZE=2> <CENTER><ADDRESS><STRONG> Playing Background Music 2<BR> by Tim Wallace <BR> timothy@essex1.com </STRONG></ADDRESS></CENTER> <HR WIDTH=200 ALIGN=center SIZE=2> <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- Activate Cloaking Device if (browser_check=="n3_or_better" && navigator.javaEn