rsines
04-26-2009, 06:40 PM
Can someone tell me what is wrong with this script. I want a different size background image to appear based on users screen resolution.
<script language="JavaScript1.2">
<!--
if (screen.width==640||screen.height==480 && document.all||document.getElementById)
document.body.style.background="url('640_bkg.gif') white bottom no-repeat fixed"
else if (screen.width==800||screen.height==600 && document.all||document.getElementById)
document.body.style.background="url('800_bkg.gif') white bottom no-repeat fixed"
else if (screen.width==1024||screen.height==768 && document.all||document.getElementById)
document.body.style.background="url('1024_bkg.gif') white bottom no-repeat fixed"
else if (document.all||document.getElementById)
document.body.style.background="url('1280_bkg.gif') white bottom no-repeat fixed"
//-->
</script>
<script language="JavaScript1.2">
<!--
if (screen.width==640||screen.height==480 && document.all||document.getElementById)
document.body.style.background="url('640_bkg.gif') white bottom no-repeat fixed"
else if (screen.width==800||screen.height==600 && document.all||document.getElementById)
document.body.style.background="url('800_bkg.gif') white bottom no-repeat fixed"
else if (screen.width==1024||screen.height==768 && document.all||document.getElementById)
document.body.style.background="url('1024_bkg.gif') white bottom no-repeat fixed"
else if (document.all||document.getElementById)
document.body.style.background="url('1280_bkg.gif') white bottom no-repeat fixed"
//-->
</script>