JavaScript: Conditional Firefox CSS

NamecheapNamecheap
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back