JavaScript: Conditional Firefox CSS

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

Albatross

Established Member
Impact
0
I have a site that looks fine in Safari and IE6 but suffers from a 1-pixel misalingment in Firefox and Camino. To fix this, I want the page to use a different CSS file if it's Firefox or Camino. I don't know JavaScript myself, though I've done programming in other languages. I got most of this from a book I have, but right now Firefox doesn't load any CSS file at all.

I have this script before my closing </head> tag:
Code:
<script type="text/javascript">
    var isKHTML = sUserAgent.indexOf("KHTML") > -1
         || sUserAgent.indexOf("Konqueror") > -1
         || sUserAgent.indexOf("AppleWebKit") > -1;'
    var isMoz = sUserAgent.indexOf("Gecko") > -1
         && !isKHTML;
    if(isMoz)
         document.writeIn(<link href="home.css" rel="stylesheet" type="text/css" />);
    else
         document.writeIn(<link href="homecopy.css" rel="stylesheet" type="text/css" />);
</script>
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back