Gordo
08-08-2002, 01:51 AM
Simple JS for many of you...but not for me. Yes, I know I really need to learn these simple JS code writing staples. Getting a quick answer would be great. I know I have bookmarked many sites wherein I could learn this...but I don't have the time right now. Anyway...
I have the following in a portion of my JavaScript code:
var boxwidth=530;
I need to have it set to 530 for +/- 800px resolution, and 670 for 1024px and up.
I've used the following in my <head> for another script, but couldn't figure out the way to "if...else" it.
<script type="text/javascript">
var res =
(screen.width<=810) ? '800' :
(screen.width>810) ? '1024' : '';
document.write('<link rel="stylesheet" type="text/css" href="css' + res + '.css">');
</script>
I have the following in a portion of my JavaScript code:
var boxwidth=530;
I need to have it set to 530 for +/- 800px resolution, and 670 for 1024px and up.
I've used the following in my <head> for another script, but couldn't figure out the way to "if...else" it.
<script type="text/javascript">
var res =
(screen.width<=810) ? '800' :
(screen.width>810) ? '1024' : '';
document.write('<link rel="stylesheet" type="text/css" href="css' + res + '.css">');
</script>