ColdSteel
08-20-2003, 01:19 PM
Well, I'm new to this forum...but here it goes....I am having some problamatic Javascript code. I am trying to code a site that loads different sized pictures according to the resolution of the viewer's screen (so that every user gets the best experience), but the way that I have it coded does not work in 800x600...it actually displays both sets of pictures, yet works fine in 1024x768....Below is the code that I am using:
<SCRIPT LANGUAGE="JavaScript">
var ScrnSize = "UnCommon"
if (navigator.appVersion.indexOf("4.") != -1 &&
navigator.appName.indexOf("Explorer") != -1) {
ScrnSize = screen.width + "x" + screen.height;
}
if (navigator.appVersion.indexOf("4.") != -1 &&
navigator.appName.indexOf("Netscape") != -1) {
ScrnSize = screen.width + "x" + (screen.height + 19);
}
switch(ScrnSize) {
case "800x600": document.write('<img src="Banner_Left(8-6).gif" width="616" height="68" hspace="0" vspace="0" border="0" align="left" usemap="#map800600"> <map name="map800600" id="map800600"><area shape="rect" coords="323,31,389,56" href="#" alt="About Us"><area shape="rect" coords="387,31,461,56" href="#" alt="Contact Info"><area shape="rect" coords="460,31,545,56" href="#" alt="Go to the Selling From"></map><img src="Banner_Right(8-6).gif" width="95" height="182" hspace="0" vspace="0" border="0" usemap="#Map8006002"> <map name="Map8006002" id="Map8006002"><area shape="poly" coords="84,5,58,5,11,62,11,173,87,172" href="#" alt="Go to the Selling Form"></map>');
case "1024x768": document.write('<img src="Banner_Right.gif" width="127" height="243"hspace="0" vspace="0" border="0" align="right" usemap="#Map1024768"> <map name="Map1024768"> <area shape="poly" coords="78,8,16,82,15,227,115,228,114,8" href="#" alt="Go to the Selling Fom"></map> <img src="Banner_Left.gif" width="821" height="90" hspace="0" vspace="0" border="0" align="right" usemap="#Map"> <map name="Map"> <area shape="rect" coords="431,42,515,73" href="#" alt="Info about S & J Properties"><area shape="rect" coords="516,42,615,73" href="#" alt="Contact info"><area shape="rect" coords="614,42,728,73" href="#" alt="Go to Selling Form"> <area shape="rect" coords="189,54,272,79" href="Mailto:stesteel@iquest.net" alt="Send us an e-mail"><area shape="rect" coords="189,54,272,79" href="Mailto:stesteel@iquest.net" alt="Send us an e-mail"></map>');
}
// End -->
</script>
I know that the links aren't in working order yet...but I'm just trying to get the compatability issue down....It's also kinda confusing with the image map and all....but any help would be greatly appreciated!!!:confused:
<SCRIPT LANGUAGE="JavaScript">
var ScrnSize = "UnCommon"
if (navigator.appVersion.indexOf("4.") != -1 &&
navigator.appName.indexOf("Explorer") != -1) {
ScrnSize = screen.width + "x" + screen.height;
}
if (navigator.appVersion.indexOf("4.") != -1 &&
navigator.appName.indexOf("Netscape") != -1) {
ScrnSize = screen.width + "x" + (screen.height + 19);
}
switch(ScrnSize) {
case "800x600": document.write('<img src="Banner_Left(8-6).gif" width="616" height="68" hspace="0" vspace="0" border="0" align="left" usemap="#map800600"> <map name="map800600" id="map800600"><area shape="rect" coords="323,31,389,56" href="#" alt="About Us"><area shape="rect" coords="387,31,461,56" href="#" alt="Contact Info"><area shape="rect" coords="460,31,545,56" href="#" alt="Go to the Selling From"></map><img src="Banner_Right(8-6).gif" width="95" height="182" hspace="0" vspace="0" border="0" usemap="#Map8006002"> <map name="Map8006002" id="Map8006002"><area shape="poly" coords="84,5,58,5,11,62,11,173,87,172" href="#" alt="Go to the Selling Form"></map>');
case "1024x768": document.write('<img src="Banner_Right.gif" width="127" height="243"hspace="0" vspace="0" border="0" align="right" usemap="#Map1024768"> <map name="Map1024768"> <area shape="poly" coords="78,8,16,82,15,227,115,228,114,8" href="#" alt="Go to the Selling Fom"></map> <img src="Banner_Left.gif" width="821" height="90" hspace="0" vspace="0" border="0" align="right" usemap="#Map"> <map name="Map"> <area shape="rect" coords="431,42,515,73" href="#" alt="Info about S & J Properties"><area shape="rect" coords="516,42,615,73" href="#" alt="Contact info"><area shape="rect" coords="614,42,728,73" href="#" alt="Go to Selling Form"> <area shape="rect" coords="189,54,272,79" href="Mailto:stesteel@iquest.net" alt="Send us an e-mail"><area shape="rect" coords="189,54,272,79" href="Mailto:stesteel@iquest.net" alt="Send us an e-mail"></map>');
}
// End -->
</script>
I know that the links aren't in working order yet...but I'm just trying to get the compatability issue down....It's also kinda confusing with the image map and all....but any help would be greatly appreciated!!!:confused: