Re: determining browser then performing function

by "r e b e c c a" <nerdygirl(at)nerdygirl.com>

 Date:  Wed, 21 Feb 2001 16:41:34 -0800
 To:  "Mike Dahlor" <mdahlor(at)bebsoft.com>,
"hwg-techniques List" <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
it sure can...  in fact, you can just add to the script that you have.
anything that is put within the curly brackets {} after an if statement will
be executed if the condition is met.  so, you would end up with something
like this:

<SCRIPT>
if (document.layers) //If Netscape
{
document.write("<LINK REL='stylesheet' TYPE='text/css'
HREF='../scripts/nsbody.css'>");

popUpWin();
//write in the stylesheet and then pop up a new window.
}
else if (document.all) //IE 4 & 5
{
document.write("<LINK REL='stylesheet' TYPE='text/css'
HREF='../scripts/iebody.css'>");
}
</SCRIPT>


you will have to define your function "popUpWin()" elsewhere within the
script tags for this to work, but the call to it just gets added to the if
statement.

hth,
rebecca
__________________________________
http://www.nerdygirl.com


-----Original Message-----
From: Mike Dahlor <mdahlor(at)bebsoft.com>
To: hwg-techniques List <hwg-techniques(at)hwg.org>
Date: Wednesday, February 21, 2001 4:32 PM
Subject: determining browser then performing function


A little quest I am on if I may intrude.  I have the following script
(received from this gracious list) that helped me see the browser and call
the appropriate style sheet.  I would like the same ability to call a
function.  In a nut shell, if netscape do this "function popupWin() {" if
not then ignore it.  Can the below script be altered to do that or does
anyone have another handy that can do the job?  Thanks!

<SCRIPT>
if (document.layers) //If Netscape
{
document.write("<LINK REL='stylesheet' TYPE='text/css'
HREF='../scripts/nsbody.css'>");
}
else if (document.all) //IE 4 & 5
{
document.write("<LINK REL='stylesheet' TYPE='text/css'
HREF='../scripts/iebody.css'>");
}
</SCRIPT>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA