Click to See Complete Forum and Search --> : Image Detection
sharkey
06-03-2004, 09:06 AM
Hey because im using css to create a layout which has a banner which always has to be 100% in width this is ok at 1024*786 but at 800*600 it cuts part of it off. So even if you use width:100%; at 800*600 you lose quality. I was wondering if there were either a javascript way or preferably php way to detect if the resolution is 800*600 then give this banner if not give the 1024*786.
Any help is greatly appreciated.
Also i thought this topic suited here the best.
96turnerri
06-03-2004, 11:29 AM
php no
js yes
<script type="text/javascript">
if (screen.width == '800') {
document.write('<img src="foo.gif" alt="" width="100%">');
} else if (screen.width == '1024') {
document.write('<img src="foo2.gif" alt="" width="100%">');
}
</script>
sharkey
06-03-2004, 11:47 AM
Thank you very much 96turnerri it is well appreciated.
One more question though where would this script go in the banner div or in the head of the document.
96turnerri
06-03-2004, 11:51 AM
banner div ;)
sharkey
06-03-2004, 05:08 PM
Thanks again 96turnerri.:)
96turnerri
06-03-2004, 05:10 PM
glad to have helped ;)
davidbrent
06-03-2004, 05:26 PM
Hello there.
Is the banner image a background or an actual image?
Best Wishes,
David
sharkey
06-03-2004, 06:08 PM
Well i suppose it could be both it could be the background of the div or i could just insert it inline.
Why?
sharkey
06-03-2004, 07:00 PM
Sorry got it to work now.