|
|
Odindon 06-23-2002, 03:07 AM I need a script that checks resolution and if the resoulution is 800by 600 it will insert image a
if resultion is 1024 by768 it will insert image b
Any help would be great thanks
newmate 06-23-2002, 03:31 AM Internet search for "resolution sniffer" produced DHTML Shock - Other - Resolution Sniffer (http://www.dhtmlshock.com/other/ResolutionSniffer/default.asp) specifically for 800 x 600 and 1024 x 768 resolutions to redirect with instructions.
Odindon 06-23-2002, 04:20 AM I appreciate the post but that isnt what Im looking for.
I need a javascript that will document write based on resolution settings.
I dont know javascript but this is what I want it to do.
If resoultion is 800 by 600 document write (pic url)
If resolution is 1024 by 768 document write (alt pic url)
newmate 06-23-2002, 07:22 PM Ok I have a simpler script that I tested in the three browsers in my sig and at both resolutions.
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
if (screen.height >= 768 && screen.width >= 1024) {
document.write("<img src='imagea.jpg' width=512 height=384 border=0>");
}
else {
if (screen.height == 600 && screen.width == 800) {
document.write("<img src='imageb.jpg' width=304 height=204 border=0>");
}
}
// End -->
</script>
Just replace the current image tag in your page scripting with the above script changing the imagea.jpg and the width=512 height=384 to fit your "a" image in your root folder for the 786/1024 statement and the same for the 600/800 statement with your "b" image specifications.
Note: Must change your monitor resolution to preview the result as it goes by the real monitors resolution set and not a web editors screen size emulation.
Same script as used for full path url.
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
if (screen.height >= 768 && screen.width >= 1024) {
document.write("<img src='http://your-web-site-address-here.com/imagea.jpg' width=512 height=384 border=0>");
}
else {
if (screen.height == 600 && screen.width == 800) {
document.write("<img src='http://your-web-site-address-here.com/imageb.jpg' width=304 height=204 border=0>");
}
}
// End -->
</script>
Edit: for small scripting syntax typo.
Odindon 06-25-2002, 05:20 AM This is exactly what I had in my head. I knew I saw document write based on resolution in scripts before. FOr isntance "Y our using a 800 by 600 resolution" So i fgured it could be done. Thanks for the help!
|
|
|
|
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum
vBulletin® v3.8.2, Copyright ©2000-2013, Jelsoft Enterprises Ltd.