473,664 Members | 2,967 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 3957
have a script that sets it when the document loads, something like:

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

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

or when the browser is re-sized:

<body onresize="setDi v()">...

--
chris

"Dmitri Shvetsov" <ds*******@cox. net> wrote in message
news:m8dYb.1617 $Vx.1438@fed1re ad03...
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="JavaS cript">
function setDiv()
{
height = screen.width - 30; // adjust 30, it'll need to remove the width of the browser window's border
document.getEle mentById("div1" ).style.height = height;
}
</script>

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

or when the browser is re-sized:

<body onresize="setDi v()">...

Nov 15 '05 #3

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

Similar topics

1
2501
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> <div> <span>
8
14461
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 page, there is a huge gap (like 3/8 inch or 25 px) between them. This is driving me bananas. What the hey am I missing? dh ------------------------------------------------ Dan Hansen ------------------------------------------------
8
5140
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 pulling a name and placing it under the thumbnail (the text is
3
5007
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 height:auto) the larger div doesn't seem to see the nested divs, and they spill out the bottom. IE seems to automatically resize the larger div as long as I set the height to 100% or any pixel size. Mozilla doesn't recognize the percent, and...
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 put either tag inside an HTML <TD> and have the same kind of scrolling effect. This would allow me to fill the screen and have the size of the scrolling box change on resize. Thanks in advance.
9
3136
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
5352
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 </p>s included as well. <P>aaaaaaaaa</p><DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</p></DIV>
5
5257
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 see what I am after as these browsers work fine. However, in FF the results are slightly different - take a look and you'll see that the <p>, within <div class="mainContent"> has shot way over to the right. I've been working on this for 2days now...
8
10029
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 editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a state where it almost passes the W3C Markup Validation Service. However, the one error, Error Line 166,...
0
8437
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8861
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8778
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7375
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4185
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2003
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.