Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 07-30-2004, 03:44 AM   #1
Member (7 bit)
 
Join Date: Jan 2002
Location: Barcelona
Posts: 85
js css redirect problem

I'm using this js to select a css depending on screen resolution:

if (window.screen.width <= 800) {
document.write('');
document.write('');
}
if (window.screen.width > 800) {
document.write('');
document.write('');
}

It's in an external js file and here's the relevant bit of the html file:







It works fine for ie and opera but not in Firefox so I was wondering if there was anything wrong with the way I've done it?

Craig
craigtaylor74 is offline   Reply With Quote
Old 07-30-2004, 09:54 AM   #2
Moderator
Staff
Premium Member
 
Join Date: Aug 2003
Location: Richmond, VA
Posts: 7,835
Can you post the script verbatim as you have it on the webpage? Spacing and such really do matter, especially since Firefox is a more strict code reader than MSIE or Opera. Use the [ php ] tags.

kram
__________________
"For today, goodbye. For tomorrow, good luck. And forever, Go Blue!"
University of Michigan President Mary Sue Coleman
kram 2.0 is offline   Reply With Quote
Old 07-30-2004, 11:54 AM   #3
Member (7 bit)
 
Join Date: Jan 2002
Location: Barcelona
Posts: 85
sorry. here are the important parts from the head and external js file:

HTML Code:
<link href="glasgowapartment.css" rel="stylesheet" type="text/css" />
<link href="index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="glasgowapartment.js"></script>
<link rel="shortcut icon" href="favicon.ico" />


Code:
if (window.screen.width <= 800) {
document.write('
HTML Code:
<link rel="stylesheet" type="text/css" href="index800.css">
'); document.write('
HTML Code:
<link rel="stylesheet" type="text/css" href="glasgowapartment800.css">
'); } if (window.screen.width > 800) { document.write('
HTML Code:
<link rel="stylesheet" type="text/css" href="glasgowapartment.css">
'); document.write('
HTML Code:
<link rel="stylesheet" type="text/css" href="index.css">
'); }
or you can view the complete source at http://www.glasgowapartment.co.uk and http://www.glasgowapartment.co.uk/glasgowapartment.js
Craig
craigtaylor74 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:50 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2