Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

JavaScript: Conditional Firefox CSS

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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.
GoDaddyGoDaddy
Appraise.net

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back