[Javascript] problem with Netscape 6
staeger
staeger at arch.ethz.ch
Thu Dec 13 08:56:30 CST 2001
Praveen wrote:
> Hi
> i am trying to display an image depending upon the screen resolution
> 1024x768 and 800x600 ).
> This is working properly in IE 5 and netscape 4.7 but not in Netscape
> 6.My method 'selectImage()' is not at all being called.
> Can any one help me in this regard?
>
> Regards,
> Praveen.
> ****************************************
>
> <script language="javascript">
> function selectImage()
> {
> if (screen.height == 768 && screen.width == 1024)
> document.bankerbanner.src = 'banner1.jpg'
> else
> if (screen.height == 600 && screen.width == 800)
> document.bankerbanner.src = "banner2.jpg"
> }
> </script> </head>
> <body bgcolor='#F2D2A4' topmargin="0" leftmargin="0">
> <table border="0" width="100%" cellspacing="0" cellpadding="0">
> <tr> <td width="100%">
> <img name="bankerbanner" border="0" width='100%' vspace='0' hspace='0'
> src='javascript:selectImage()'></img></td> </tr>
> </table>
> </body>
why not printing the whole IMG-statement by javascript ...
<script language="javascript">
var bannerSrc = (screen.width >= 1024) ? "banner1.jpg" : "banner1.jpg";
document.writeln("<img name='bankerbanner' border='0' width='100%'
vspace='0' hspace='0' src='"+bannerSrc+"'>");
</script>
greets ben./
More information about the Javascript
mailing list