473,569 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resize Window to handle *displayed* elements...

SPG
Hi,

Please diregard my previous post...

I have found out that doing a window.resizeTo (w,h) does not resize the
client area tot his size, but the entire window (including tool bars etc).

So, with an address bar, a tool bar and a status bar etc showing, the
window.document .body.offsetHei ght value will be ~200 points smaller than the
required size.

We have a simple set of data in a table, but it can resize based on a font
size.
On change of font from a combo we call a resize function.

How can I ensure that the body.offsetHeig ht and widths are enough to show
all of my table, without hard coding for toolbars etc (Because they may not
be there on some browsers.)

Is there a way like in java to *pack* the client area to best fit?

Steve
Jul 23 '05 #1
1 1630
SPG
And here is a bit of sample code..

<html>
<head>

<script language="javas cript">
function reSizeWindow()
{
var winHeightOffset = 25; //We seem to need to add this to make the screen
fit..??
var iHeight;
var iWidth;
var iMaxIGSComposit eHeight;
var iMenuHeight=0;

iWidth = 680;
iMaxIGSComposit eHeight = 580;

var oTableW;
var oTableH;
var oTableMenu = document.getEle mentById('tMenu ');
if( oTableMenu !=null)
{
iMenuHeight = oTableMenu.offs etHeight;
}

oTableW = window.tblMain;
oTableH = oTableW;

try
{
var tH = oTableH.offsetH eight;
var menuH = oTableMenu.offs etHeight;
iHeight = tH + menuH + winHeightOffset ;
iWidth = window.document .body.offsetWid th;
window.resizeTo (iWidth, iHeight);
alert("DONE: New Height: " + iHeight + ", Window Height: " +
window.document .body.offsetHei ght );

}
catch(e)
{
alert(e);
}

}
</script>
</head>
<body>
<table border=1 id="tMenu">
<tr><td><a onclick="reSize Window()">Resiz e</a></td></tr>
</table>
<table border=1 id="tblMain">
<tr>
<td>a</td>
</tr>
<tr>
<td>a</td>
</tr>
<tr>
<td>a</td>
</tr>
<tr>
<td>a</td>
</tr>
<tr>
<td>a</td>
</tr>
<tr>
<td>a</td>
</tr>
<tr>
<td>a</td>
</tr>
<tr>
<td>a</td>
</tr>
</table>
</body>
</html>
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1841
by: Charles Packer | last post by:
From one of the online Javascript tutorials, I learned how to open a new window and set its size. I'm building a page that has several small photographs, and I want to let the viewer examine either a full size image or an image with supporting detail. It's the same idea used on lots of Web sites that show thumbnails where you click on one and...
25
19911
by: chris | last post by:
how would i resize a browser window to a specific size as the page loads, using html or javascript
2
2066
by: arkascha | last post by:
Hi everybody, after trying 'round for hours and wishing all browser engine programmers to hell :-) I'd like to ask if anyone knows a solution for this: A dynamically created html page contains a body tag with a single (filled) table in it. Sie size of the table changes in a wide scale (from 5% to 150% of the screen size independent in...
4
1955
by: al | last post by:
Hi, When Resizing (maximize and minimize actions) a window, does IE 5.0 adjust asp.net page controls so they are aligned, or do i have to do it(aligning) in code? MTIA, Grawsha
69
13374
by: RC | last post by:
I know how to do this in JavaScript by window.open("newFile.html", "newTarget", "scrollbars=no,resizable=0,width=200,height=200"); The browser will open a new window size 200x200, not allow resize and no auto horizontal, vertical scrolling bars. I am wonder can I do the similar inside a HTML file like
8
2342
by: Robert S | last post by:
I am writing an image viewer. I want to be able to resize the image so that it always fits within a window of given height and width. I've tried a couple of these from the web, but the don't seem to take into account both the image dimensions AND the window dimensions. Are there any algorithms out there? I'm not keen on reinventing the...
15
3159
RedSon
by: RedSon | last post by:
Yea! Now after years of applications work I have finally bit the bullet and gotten myself a website playground. But I am running into a problem. I want to be able to make some money off this site when a user wants to search for something. So I set up google to be my search engine of choice and whenever someone searches something google populates a...
5
2737
by: Doug Gunnoe | last post by:
I'm considering resizing a div onload to better match the screen width of the user. Easy enough, however it seems that I have read in this group that there are potential problems with this, differences amongst the browsers, inconsistence in determining screen size, and debate about which property to use - and by this I believe there is...
7
2586
by: Anz | last post by:
Can any one know the javascript function to auto resize the swf when resizing its pop up window. I need to auto resize the swf when i resize my popup window in which the swf is displayed. Is there any javascript function available to perform this requirement ?
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.