[Javascript] Javascript digest, Vol 1 #540 - 3 msgs

sandra_tibbs at abicon.com sandra_tibbs at abicon.com
Tue Dec 17 11:41:00 CST 2002


(Embedded image moved to file: pic31998.jpg)
Send Javascript mailing list submissions to
      javascript at LaTech.edu

To subscribe or unsubscribe via the World Wide Web, visit
      https://lists.LaTech.edu/mailman/listinfo/javascript
or, via email, send a message with subject or body 'help' to
      javascript-request at LaTech.edu

You can reach the person managing the list at
      javascript-admin at LaTech.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Javascript digest..."


Today's Topics:

   1. Browser sniffer script question (Lisa Bradshaw)
   2. Re: Browser sniffer script question (Michael J. Mahony)
   3. Re: Browser sniffer script question (Lisa Bradshaw)

--__--__--

Message: 1
From: "Lisa Bradshaw" <zibbler at mediaone.net>
To: <javascript at LaTech.edu>
Date: Fri, 1 Feb 2002 18:27:56 -0500
Subject: [Javascript] Browser sniffer script question
Reply-To: javascript at LaTech.edu

Hi all,

I don't know a whole lot of javascript. I'm mostly a cut-n-paster. I know
enough to usually be able to tweek a script for my needs. I'm using a
browser sniffer so I can determine what style sheet to serve up. Problem
is,
I don't know how to translate it fron HTML. Any help would be most
appreciated. What I want to do is, if the browser is NN4 I want a specific
style sheet loaded into the parent window. Here's the HTML way to load the
style sheet:
 <.link rel="stylesheet" type="text/css" href="styles.css">  but how do I
do
it whithin a javascript "if " statement?
TIA,
Lisa


--__--__--

Message: 2
From: "Michael J. Mahony" <igby at mediaone.net>
To: javascript at LaTech.edu
Date: Fri, 1 Feb 2002 15:42:04 -0700
Subject: Re: [Javascript] Browser sniffer script question
Reply-To: javascript at LaTech.edu



On 1 Feb 2002 at 18:27, Lisa Bradshaw wrote:

> Hi all,
>
> I don't know a whole lot of javascript. I'm mostly a cut-n-paster. I know
> enough to usually be able to tweek a script for my needs. I'm using a
> browser sniffer so I can determine what style sheet to serve up. Problem
is,
> I don't know how to translate it fron HTML. Any help would be most
> appreciated. What I want to do is, if the browser is NN4 I want a
specific
> style sheet loaded into the parent window. Here's the HTML way to load
the
> style sheet:
>  <.link rel="stylesheet" type="text/css" href="styles.css">  but how do I
do
> it whithin a javascript "if " statement?
> TIA,
> Lisa


Test for the browser type and then insert the stylesheet information with a
document.write command:

function insertStylesheet()
{
if(navigator.appName=="Microsoft Internet Explorer")
{
      document.write "<.link rel='stylesheet' type='text/css'
href='iestyles.css'>"
}

if(navigator.appName=="Netscape")
{
      document.write "<.link rel='stylesheet' type='text/css'
href='nsstyles.css'>"
}
}

Just call this function where you would want to insert the style sheet:

<html>
<head>
<title>Document</title>
<script language ="javascript">
insertStylesheet()
</script>
</head>
<body>
blahblahblah
</body>
</html>

Hope that helps.
Michael J. Mahony

Philippians 4:13 --
    I can do all things through Him who strengthens me.



--__--__--

Message: 3
From: "Lisa Bradshaw" <zibbler at mediaone.net>
To: <javascript at LaTech.edu>
Subject: Re: [Javascript] Browser sniffer script question
Date: Sat, 2 Feb 2002 12:12:37 -0500
Reply-To: javascript at LaTech.edu

Thanks Michael!

That did the trick!


----- Original Message -----
From: "Michael J. Mahony" <igby at mediaone.net>
To: <javascript at LaTech.edu>
Sent: Friday, February 01, 2002 5:42 PM
Subject: Re: [Javascript] Browser sniffer script question


>
> Test for the browser type and then insert the stylesheet information with
a
> document.write command:
>
> function insertStylesheet()
> {
> if(navigator.appName=="Microsoft Internet Explorer")
> {
> document.write "<.link rel='stylesheet' type='text/css'
href='iestyles.css'>"
> }
>
> if(navigator.appName=="Netscape")
> {
> document.write "<.link rel='stylesheet' type='text/css'
href='nsstyles.css'>"
> }
> }
>
> Just call this function where you would want to insert the style sheet:
>
> <html>
> <head>
> <title>Document</title>
> <script language ="javascript">
> insertStylesheet()
> </script>
> </head>
> <body>
> blahblahblah
> </body>
> </html>
>
> Hope that helps.
> Michael J. Mahony
>
> Philippians 4:13 --
>     I can do all things through Him who strengthens me.
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>



--__--__--

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


End of Javascript Digest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic31998.jpg
Type: image/jpeg
Size: 1868 bytes
Desc: not available
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20021217/f5bf90c8/attachment.jpg>


More information about the Javascript mailing list