bparker19
05-15-2003, 09:46 AM
I'm trying to get a script to detect screen resolution and select one of two background images (one for 800x600 and one for 1024x768).
I searched the forum and found a script in another thread that was said to work, but I'm clearly doing something wrong. Could someone take a look at it and offer some helpful feedback? I really don't know much about JS, but I would really like to get this to work.
Here is the script:
__________
<script language="javaScript" type="text/javascript">
var Pic = new Array()
Pic[0] = 'stratbkgrd3.gif' //800x600
Pic[1] = 'stratbkgrd1024.gif' //1024x768
if(screen.width==800)
{
document.body.background = Pic[0];
}
else if(screen.width==1024)
{
document.body.background = Pic[1];
}
</script>
____________
I am getting an error on the "document.body.background" part.
Thanks for any help! :)
I searched the forum and found a script in another thread that was said to work, but I'm clearly doing something wrong. Could someone take a look at it and offer some helpful feedback? I really don't know much about JS, but I would really like to get this to work.
Here is the script:
__________
<script language="javaScript" type="text/javascript">
var Pic = new Array()
Pic[0] = 'stratbkgrd3.gif' //800x600
Pic[1] = 'stratbkgrd1024.gif' //1024x768
if(screen.width==800)
{
document.body.background = Pic[0];
}
else if(screen.width==1024)
{
document.body.background = Pic[1];
}
</script>
____________
I am getting an error on the "document.body.background" part.
Thanks for any help! :)