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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen Size

Status
Not open for further replies.

lcfc

Programmer
Dec 4, 2001
27
GB
Hi i am trying to create a web page that works at different screen resolutions. At present i use a script that checks the resolution and loads a frameset accordingly. This is not economical as i have to produce three x amount of frames, per frameset (see below):

<script language=&quot;JavaScript&quot;>
var s800x600page = &quot;index1.htm&quot;;
var s1024x768page = &quot;index2.htm&quot;;
var s1152x864page = &quot;index3.htm&quot;;
var pagetype;
if ((screen.height == 600) && (screen.width == 800)) {
pagetype = 1; }
else if ((screen.height == 768) && (screen.width == 1024)) {
pagetype = 2; }
else if ((screen.height == 864) && (screen.width == 1152)) {
pagetype = 3; }
else {
pagetype = 3; }
if (pagetype == 1) { window.location.href = s800x600page }
else if (pagetype == 2) { window.location.href = s1024x768page }
else if (pagetype == 3) { window.location.href = s1152x864page }
//-->
</script>

The only frame that changes in the frameset is main frame. Therefore i wonder if anyone can help me out with a script that checks the amount of screen available and resizes the mainFrame accordingly. Also is it possible to resize the mainFrame in relation to the favourites bar, so the screen will fit (i.e. no scrolling) even if the bar is pulled across the screen?
 
is this what you want?
Code:
<script language='javascript'><!--
if ((screen.height == 600) && (screen.width == 800)) {
window.frames[&quot;main&quot;].outerheight = 600;
window.frames[&quot;main&quot;].outerwidth = 350; }
else if ((screen.height == 768) && (screen.width == 1024)) {
window.frames[&quot;main&quot;].outerheight = 768;
window.frames[&quot;main&quot;].outerwidth = 512; }
else if ((screen.height == 864) && (screen.width == 1152)) {
window.frames[&quot;main&quot;].outerheight = 864;
window.frames[&quot;main&quot;].outerwidth = 600;  }
else {
window.frames[&quot;main&quot;].outerheight = 600;
window.frames[&quot;main&quot;].outerwidth = 350;  }
//--></script>
hope it helps &quot;Those who dare to fail miserably can achieve greatly.&quot; - Robert F. Kennedy
So true..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top