Old 24-01-2005, 16:21   #1 (permalink)
explosive
Registered User
 
Join Date: Jan 2005
Posts: 1
Javascript Problem in FireFox

Hi

ive written a piece of javascript to detect the users screen res and display a different sized logo image depending on the res.

The code works fine in Internet Explorer but doesn't work in FireFox.



Code:
<script type="text/javascript"> <!-- if ((window.screen.width==1024) && (window.screen.height==768)) { document.write('<img src="images/logo1024_768.jpg" alt="logo" class="explo_title" />'); } else if ((window.screen.width==800) && (window.screen.height==600)) { document.write('<img src="images/logo800_600.jpg" alt="logo" class="explo_title" />'); } //--> </script>


Any ideas why?
  Reply With Quote
Old 25-01-2005, 05:56   #2 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
not sure, might be something to do with the width not being exactly 1024 wide, maybe try:

window.screen.width>1000

rather than trying to guess the exact size - seems a pretty weird thing to be doing anyway.

surely it should be the other way round anyway - if 800x600 then display small image, else, large image - what happens if your resoution is different from either of those specified in the script?
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8