Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html help with finding a code

Status
Not open for further replies.

manly

Programmer
Aug 5, 1999
8
US
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.
 
&lt;html&gt;<br>
<br>
&lt;head&gt;<br>
&lt;title&gt;Checking Screen Resolution&lt;/title&gt;<br>
&lt;/head&gt;<br>
&lt;script language="JavaScript"&gt;&lt;!--<br>
// Relative positions of the two pages<br>
ver = "";<br>
bName = navigator.appName;<br>
bVer = parseInt(navigator.appVersion);<br>
if (bName == "Netscape" && bVer &gt;= 3) ver = "n3"; &lt;!-- Netscape V3 or greater --&gt;<br>
if (bName =="Microsoft Internet Explorer" && bVer &gt;= 3) ver= "i3"; &lt;!-- IE V3 or greater --&gt;<br>
function checkres(){<br>
if (ver == "i3"){ &lt;!-- For IE 3.2 or better --&gt;<br>
var resside=window.screen.width; <br>
if (resside &lt; 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 &lt; 1000){strLast = "index_s.htm";}<br>
if (resside &gt; 1000){strLast = "index_m.htm";}<br>
if (resside &gt; 1200){strLast = "index_h.htm";}<br>
}<br>
if (ver == "n3"){ &lt;!-- For Netscape 3.0 or better --&gt;<br>
var toolkit = Packages.java.awt.Toolkit.getDefaultToolkit();<br>
var screen_size = toolkit.getScreenSize();<br>
resside=screen_size.width<br>
if (resside &lt; 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 &lt; 1000){strLast = "index_s.htm";}<br>
if (resside &gt; 1000){strLast = "index_m.htm";}<br>
if (resside &gt; 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")&gt;-1))<br>
{<br>
// Getting the correct pathname for MSIE (Replace '\' with '/'). NS will skip this portion.<br>
while(strDir.indexOf("\\")&gt;-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("/")&lt;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>
//--&gt;&lt;/script&gt;<br>
<br>
<br>
&lt;body BGCOLOR="#FFFFFF" onload="checkres()"&gt;<br>
<br>
&lt;p align="center"&gt;&nbsp;&lt;/p&gt;<br>
&lt;script language="JavaScript"&gt;&lt;!--<br>
// for testing purposes<br>
//document.write("&lt;p&gt;This: "+strThis+"&lt;br&gt;");<br>
//document.write("Dir: "+strDir+"&lt;br&gt;");<br>
//document.write("Doc: "+strDoc+"&lt;br&gt;");<br>
//document.write("Domain: "+strDomain+"&lt;br&gt;");<br>
//document.write("Protocol: "+strProtocol+"&lt;br&gt;");<br>
//document.write("Target: "+strTarget+"&lt;/p&gt;");<br>
<br>
//--&gt;<br>
&lt;/script&gt;<br>
<br>
<br>
&lt;p align="center"&gt;&lt;font face="Arial"&gt;It seems that your browser is not Java enabled.&lt;/font&gt;&lt;/p&gt;<br>
<br>
&lt;p align="center"&gt;&lt;font face="Arial"&gt;Please select, in which screen resolution you want to<br>
see the maps:&lt;/font&gt;&lt;/p&gt;<br>
<br>
&lt;p align="center"&gt;&lt;font face="Arial"&gt;&lt;a href="index_s.htm"&gt;&lt;strong&gt;Low resolution &lt;/strong&gt;&lt;/a&gt;&lt;small&gt;(for<br>
a 800 x 600 pixel screen)&lt;/small&gt;&lt;/font&gt;&lt;/p&gt;<br>
<br>
&lt;p align="center"&gt;&lt;font face="Arial"&gt;&lt;a href="index_m.htm"&gt;&lt;strong&gt;Medium resolution&lt;/strong&gt;&lt;/a&gt;<br>
&lt;small&gt;(for a 1024 x 768 pixel screen)&lt;/small&gt;&lt;/font&gt;&lt;/p&gt;<br>
<br>
&lt;p align="center"&gt;&lt;font face="Arial"&gt;&lt;a href="index_h.htm"&gt;&lt;strong&gt;High resolution&lt;/strong&gt;&lt;/a&gt;<br>
&lt;small&gt;(for a 1280 x 1024 pixel screen)&lt;/small&gt;&lt;/font&gt;&lt;/p&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<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 &lt; 1000){strLast = "index_s.htm";}<br>
if (resside &gt; 1000){strLast = "index_m.htm";}<br>
if (resside &gt; 1200){strLast = "index_h.htm";}<br>
<br>
needs to be changed to:<br>
<br>
if (resside &lt; 1000){strLast = "index_s.htm";}<br>
if ((resside &gt; 1000) && (resside &lt; 1200)){strLast = "index_m.htm";}<br>
if (resside &gt; 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top