<div> and screen size

  • Thread starter Thread starter Dmitri Shvetsov
  • Start date Start date
D

Dmitri Shvetsov

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
 
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()">...
 
Hi Chris,

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

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/clientcaps/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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top