Javascript question

by "Lynn Struble" <lstruble(at)gw.libofmich.lib.mi.us>

 Date:  Thu, 10 Feb 2000 17:10:50 -0500
 To:  <hwg-basics(at)hwg.org>
  todo: View Thread, Original
Here I am again, needing more assistance.  :)

I am trying to write a javascript that will determine if the client is IE =
or Netscape.
It then plays a background sound for IE or and Embedded sound for =
Netscape.
It seems to work fine for IE.  But not on Netscape.
When I look at the source on Netscape it shows both the Bkground sound and =
embed commands.
My Netscape is 4.08 and is Javascript enabled.

Any assistance would be great.  :)

Thanks,
Lynn


Here is the code:

<HTML>
<HEAD>
<TITLE>LadyWolfMoon's Den</TITLE>

<!---  javascript  --->
<SCRIPT language=3D"Javascript">

<!-- HIDE THE JAVASCRIPT
//set the status bar
//window.status=3D"Welcome to Lady Wolfmoon's Den";
defaultStatus=3D"Welcome to Lady Wolfmoon's Den";

//create browser object
var browser =3D new Object();

//load browser version
browser.version =3D parseInt(navigator.appVersion);


//determine what browser is used
browser.isNavigator=3Dfalse;
browser.isIE=3Dfalse;
if(navigator.appName.indexOf("Netscape") !=3D -1)
  {
    browser.isNavigator=3Dtrue;
  }
else if(navigator.appName.indexOf("Microsoft") !=3D -1)
  {
    browser.isIE=3Dtrue;
  }

//play the sound if they use ie
if(browser.isIE=3Dtrue)
  {
     document.write('<BGSOUND SRC=3D"wolves.wav" loop=3D1>');
  }

//  END OF HIDE SCRIPT-->
</SCRIPT>


</HEAD>

<BODY background=3D"wolf10.jpg">

<!-- play the sound if they are using Netscape -->
<SCRIPT language=3D"JavaScript">
<!-- hide me
if(browser.isNavigator=3Dtrue)
  {
    document.write('<EMBED SRC=3D"wolves.wav" AUTOSTART=3D"true" HIDDEN>');=

  }
// unhide -->
</SCRIPT>

<!-- other code here -->

</BODY>
</HTML>

HTML Guild: hwg-basics mailing list archives, maintained by Web Professionals @ IWA