473,507 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<div> and screen size

Hi,

I'm using these strings around DataGrid

<div ID="div1" style="LEFT: 4px; OVERFLOW: auto; WIDTH: 100%; POSITION:
absolute; TOP: 248px; HEIGHT: 300px">

....datagrid...

</div>

It works fine if both the screen sizes are the same, during design and
running.

How can I modify the absolute "HEIGHT: 300px" to adjust to a current screen
resolution? The problem is that I can't use percents because the header
above this this datagrid is a more or less permanent and I can't resize all
my controls on the header. I know that I can detect a current screen size
using "window." but can I use this value to change HEIGHT of this <div> on
the fly? I need to resize this <div> from required position to the very end
of the screen. I tried to use the mathematical equation instead of a real
number for the HEIGHT: value but it didn't work.

Dmitri
Nov 15 '05 #1
2 3953
have a script that sets it when the document loads, something like:

<script language="JavaScript">
function setDiv()
{
height = screen.width - 30; // adjust 30, it'll need to remove the width
of the browser window's border
document.getElementById("div1").style.height = height;
}
</script>

<body onload="setDiv()">...

or when the browser is re-sized:

<body onresize="setDiv()">...

--
chris

"Dmitri Shvetsov" <ds*******@cox.net> wrote in message
news:m8dYb.1617$Vx.1438@fed1read03...
Hi,

I'm using these strings around DataGrid

<div ID="div1" style="LEFT: 4px; OVERFLOW: auto; WIDTH: 100%; POSITION:
absolute; TOP: 248px; HEIGHT: 300px">

...datagrid...

</div>

It works fine if both the screen sizes are the same, during design and
running.

How can I modify the absolute "HEIGHT: 300px" to adjust to a current screen resolution? The problem is that I can't use percents because the header
above this this datagrid is a more or less permanent and I can't resize all my controls on the header. I know that I can detect a current screen size
using "window." but can I use this value to change HEIGHT of this <div> on
the fly? I need to resize this <div> from required position to the very end of the screen. I tried to use the mathematical equation instead of a real
number for the HEIGHT: value but it didn't work.

Dmitri

Nov 15 '05 #2
Hi Chris,

Thank you for this answer. You know, after reading of your answer I found
this page:

http://msdn.microsoft.com/library/de...s/overview.asp

and tested it. You can click the links at this page to see your screen
parameters.

availHeight - Retrieves the height of the working area of the system's
screen, excluding the Microsoft WindowsR taskbar.
height - Retrieves the vertical resolution of the screen.

That's true - these methods show me 1136 and 1200 pixels. So there is no
reason to use these functions, this approach can show the screen resolution.
But I need a current size of IE window to resize my DIV element using the
"onresize" event.

Does somebody know how to get the current IE window size?

Thanks,
Dmitri

"Chris Small"
<script language="JavaScript">
function setDiv()
{
height = screen.width - 30; // adjust 30, it'll need to remove the width of the browser window's border
document.getElementById("div1").style.height = height;
}
</script>

<body onload="setDiv()">...

or when the browser is re-sized:

<body onresize="setDiv()">...

Nov 15 '05 #3

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

Similar topics

1
2487
by: Philo | last post by:
How do I select all <div> tags except those which contain a <table> tag somewhere within them? Example XML: <********************** sample input ***********************> <txtSectionBody>...
8
14448
by: Daniel Hansen | last post by:
I know this must seem totally basic and stupid, but I cannot find any reference that describes how to control the spacing between <p>...</p> and <div>...</div> blocks. When I implement these on a...
8
5127
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
3
5000
by: Philip | last post by:
I am trying to make a bunched of left-floated divs that will be contained in a larger div. the floated divs all contain a left-floated img and text of varying sizes. If I don't set a height (or...
44
919
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to...
9
3121
by: Julia Briggs | last post by:
How do I construct a <iframe> or equivalent for FireFox/NS browsers, inside a screen centered <div> tag? Can it be done?
28
5319
by: Kent Feiler | last post by:
1. Here's some html from a W3C recommendations page. <P>aaaaaaaaa<DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</DIV> 2.Although I didn't think it would make any difference, I tried it with the...
5
5245
nathj
by: nathj | last post by:
Hi All, I'm working on a new site that has a two column layout underneath a title bar. If you check out: http://www.christianleadership.org.uk/scratch/mainpage.php using IE or Opera you will...
8
10015
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF...
0
7223
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,...
0
7319
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,...
0
7376
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...
1
7031
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...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1542
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 ...
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.