rsines
12-23-2002, 05:42 PM
I am trying to write a script to resize images according to the viewers screen resolution. Can anyone tell me whats wrong with this script?
<SCRIPT LANGUAGE="JavaScript1.2">
if (screen.height>=960 & screen.width>=1280)
{document.write("<img src='background.jpg' width=1250 height=731>");}
{document.write("<img src='title.gif' width=180 height=44>");}
{document.write("<img src='rose.gif' width=93 height=133>");}
{document.write("<img src='divider.gif' width=514 height=51>");}
else
if (screen.height=864 & screen.width=1152)
{document.write("<img src='background.jpg' width=1125 height=658>");}
{document.write("<img src='title.gif' width=162 height=39>");}
{document.write("<img src='rose.gif' width=83 height=119>");}
{document.write("<img src='divider.gif' width=462 height=46>");}
else
if (screen.height=768 & screen.width=1024)
{document.write("<img src='background.jpg' width=1000 height=585>");}
{document.write("<img src='title.gif' width=144 height=35>");}
{document.write("<img src='rose.gif' width=74 height=106>");}
{document.write("<img src='divider.gif' width=411 height=41>");}
else
if (screen.height=720 & screen.width=960)}
{document.write("<img src='background.jpg' width=938] height=548>");}
{document.write("<img src='title.gif' width=135 height=33>");}
{document.write("<img src='rose.gif' width=69 height=99>");}
{document.write("<img src='divider.gif' width=385 height=38>");}
else {document.write("<img src='background.jpg' width=781 height=457>"); }
{document.write("<img src='title.gif' width=113 height=27>"); }
{document.write("<img src='rose.gif' width=58 height=83>"); }
{document.write("<img src='divider.gif' width=321 height=32>"); }
</script>
<SCRIPT LANGUAGE="JavaScript1.2">
if (screen.height>=960 & screen.width>=1280)
{document.write("<img src='background.jpg' width=1250 height=731>");}
{document.write("<img src='title.gif' width=180 height=44>");}
{document.write("<img src='rose.gif' width=93 height=133>");}
{document.write("<img src='divider.gif' width=514 height=51>");}
else
if (screen.height=864 & screen.width=1152)
{document.write("<img src='background.jpg' width=1125 height=658>");}
{document.write("<img src='title.gif' width=162 height=39>");}
{document.write("<img src='rose.gif' width=83 height=119>");}
{document.write("<img src='divider.gif' width=462 height=46>");}
else
if (screen.height=768 & screen.width=1024)
{document.write("<img src='background.jpg' width=1000 height=585>");}
{document.write("<img src='title.gif' width=144 height=35>");}
{document.write("<img src='rose.gif' width=74 height=106>");}
{document.write("<img src='divider.gif' width=411 height=41>");}
else
if (screen.height=720 & screen.width=960)}
{document.write("<img src='background.jpg' width=938] height=548>");}
{document.write("<img src='title.gif' width=135 height=33>");}
{document.write("<img src='rose.gif' width=69 height=99>");}
{document.write("<img src='divider.gif' width=385 height=38>");}
else {document.write("<img src='background.jpg' width=781 height=457>"); }
{document.write("<img src='title.gif' width=113 height=27>"); }
{document.write("<img src='rose.gif' width=58 height=83>"); }
{document.write("<img src='divider.gif' width=321 height=32>"); }
</script>