what is the html code and string for displaying a web page in users display resolution? web was authored in 640 x 480, however there are three viewing resolutions for different users. i need the code for allowing web to be dispalyed in any resolution.
<html><br>
<br>
<head><br>
<title>Checking Screen Resolution</title><br>
</head><br>
<script language="JavaScript"><!--<br>
// Relative positions of the two pages<br>
ver = "";<br>
bName = navigator.appName;<br>
bVer = parseInt(navigator.appVersion);<br>
if (bName == "Netscape" && bVer >= 3) ver = "n3"; <!-- Netscape V3 or greater --><br>
if (bName =="Microsoft Internet Explorer" && bVer >= 3) ver= "i3"; <!-- IE V3 or greater --><br>
function checkres(){<br>
if (ver == "i3"){ <!-- For IE 3.2 or better --><br>
var resside=window.screen.width; <br>
if (resside < 650){alert("Your screen resolution is too low for this application! Please use at least a resolution of 800 x 600 pixls");}<br>
if (resside < 1000){strLast = "index_s.htm";}<br>
if (resside > 1000){strLast = "index_m.htm";}<br>
if (resside > 1200){strLast = "index_h.htm";}<br>
}<br>
if (ver == "n3"){ <!-- For Netscape 3.0 or better --><br>
var toolkit = Packages.java.awt.Toolkit.getDefaultToolkit();<br>
var screen_size = toolkit.getScreenSize();<br>
resside=screen_size.width<br>
if (resside < 650){alert("Your screen resolution is too low for this application! Please use at least a resolution of 800 x 600 pixls");}<br>
if (resside < 1000){strLast = "index_s.htm";}<br>
if (resside > 1000){strLast = "index_m.htm";}<br>
if (resside > 1200){strLast = "index_h.htm";}<br>
}<br>
// Create the target URL and redirect<br>
strTarget="";<br>
strTarget=strProtocol+"//"+strDomain+strDir+strLast;<br>
location.replace(strTarget);<br>
}<br>
<br>
<br>
// Get the current URL and split it to the domain, directory and other parts.<br>
strThis=location.href;<br>
strProtocol=location.protocol;<br>
strDir=location.pathname;<br>
if((strProtocol=="file:")&&(navigator.appName.indexOf("Microsoft")>-1))<br>
{<br>
// Getting the correct pathname for MSIE (Replace '\' with '/'). NS will skip this portion.<br>
while(strDir.indexOf("\\")>-1)<br>
{<br>
strDir=strDir.substr(0,strDir.indexOf("\\"))+"/"+strDir.substr(strDir.indexOf("\\")+1,strDir.length);<br>
}<br>
}<br>
arryAny=strDir.split("/");<br>
if(strDir.lastIndexOf("/")<strDir.length){<br>
strDoc=strDir.substr(strDir.lastIndexOf("/")+1,strDir.length);<br>
strDir=strDir.substr(0,strDir.lastIndexOf("/")+1);<br>
}else{<br>
strDoc="";<br>
}<br>
strDomain=location.host;<br>
<br>
//--></script><br>
<br>
<br>
<body BGCOLOR="#FFFFFF" onload="checkres()"><br>
<br>
<p align="center"> </p><br>
<script language="JavaScript"><!--<br>
// for testing purposes<br>
//document.write("<p>This: "+strThis+"<br>");<br>
//document.write("Dir: "+strDir+"<br>");<br>
//document.write("Doc: "+strDoc+"<br>");<br>
//document.write("Domain: "+strDomain+"<br>");<br>
//document.write("Protocol: "+strProtocol+"<br>");<br>
//document.write("Target: "+strTarget+"</p>");<br>
<br>
//--><br>
</script><br>
<br>
<br>
<p align="center"><font face="Arial">It seems that your browser is not Java enabled.</font></p><br>
<br>
<p align="center"><font face="Arial">Please select, in which screen resolution you want to<br>
see the maps:</font></p><br>
<br>
<p align="center"><font face="Arial"><a href="index_s.htm"><strong>Low resolution </strong></a><small>(for<br>
a 800 x 600 pixel screen)</small></font></p><br>
<br>
<p align="center"><font face="Arial"><a href="index_m.htm"><strong>Medium resolution</strong></a><br>
<small>(for a 1024 x 768 pixel screen)</small></font></p><br>
<br>
<p align="center"><font face="Arial"><a href="index_h.htm"><strong>High resolution</strong></a><br>
<small>(for a 1280 x 1024 pixel screen)</small></font></p><br>
</body><br>
</html><br>
<br>
<br>
<br>
<br>
Unfortunately the lines wrap.
thank you, for your help. perhaps i wasnt clear enouth.the creation was done in Microsoft Front page explorer ver. 3.0.2.1706 if there is a code specific to this program, can you please share that with me? thank you again
Only one problem with tht code:<br>
<br>
if (resside < 1000){strLast = "index_s.htm";}<br>
if (resside > 1000){strLast = "index_m.htm";}<br>
if (resside > 1200){strLast = "index_h.htm";}<br>
<br>
needs to be changed to:<br>
<br>
if (resside < 1000){strLast = "index_s.htm";}<br>
if ((resside > 1000) && (resside < 1200)){strLast = "index_m.htm";}<br>
if (resside > 1200){strLast = "index_h.htm";}<br>
<br>
otherwise the JS will not check to see if the resolution is greater than 1200 as it stops whenever if finds a "true" answer. (or maybe not......bot that WOULD hold true if it were "else branched"...which would make it MUCH more efficient, though I'm a little too rusty to remember how to do that.)<br>
<br>
<br>
-robherc
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.