Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Using Javascript to set Stylesheet based on Browser, not Recognized

    I've tried to make a quick Javascript to pick between two Stylesheets depending on what browser is being used. The problem result is that neither Stylesheet is being applied. Can anyone help with what I'm doing incorrectly? Thanks.

    <script language="Javascript" script type="text/javascript">
    if (navigator.appCodeName=="Mozilla") {
    <link rel="stylesheet" type="text/css" href="cis_nie.css" />
    }
    else {
    <link rel="stylesheet" type="text/css" href="cis.css" />
    }
    </script>
    Last edited by paulr; 10-13-2005 at 04:52 PM.

  • #2
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is this question not challenging enough or something?

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no need to use javascript for that

    <link rel="stylesheet" href="InternetEX.css" media="all">
    <link rel="stylesheet" href="firefox.css" media="screen and all">
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #4
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow! Thanks! I didn't think it would be that easy! How does it select between viewing what is appropriate for varied settings, like UL, which differ in the CSS meant for Firefox versus IE?
    Last edited by paulr; 10-13-2005 at 07:00 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •