Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 15th, 2007, 05:42 AM
Authorized User
Join Date: Jun 2007
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hericles
Default Changing stylesheets in FF & IE6

I'm working on a site and am trying to get the stylesheets to automatically detect the browser using javascript and load the correct one. I've done before and its worked but this time I'm having no luck. Despite changing the code around both browsers continue to use the one stylesheet which is causing display problems.
Here's the code:
<link rel="stylesheet" type="text/css" href="style.css" name="ie">
   <link rel="stylesheet" type="text/css" href="style_ff.css" name="ff">
   <script language="javascript">
      var name = navigator.appName;
      if (name == "Netscape")
         document.styleSheets.title = "ff";
      else (name == "Microsoft Internet Explorer")
            document.styleSheets.title = "ie";

Any hints/tps/alternative methods would be appreciated.
Thank you,

"I will prepare and one day my chance will come."
\"I will prepare and one day my chance will come.\"

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i remove active link border in IE & FF? kaos_frack CSS Cascading Style Sheets 5 March 7th, 2007 12:21 PM
about changing dsn & server.mappath liniyer_667 Classic ASP Databases 0 June 12th, 2005 11:18 AM
Changing StyleSheets [email protected] Javascript How-To 2 May 18th, 2004 03:40 PM
creation of user & Changing password for existing fathima Classic ASP Components 0 November 12th, 2003 05:13 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.