Click to See Complete Forum and Search --> : size of DIV


stmasi
06-05-2003, 05:50 PM
Is there any way to set the size of a DIV or the size of an IFRAME based on the viewable area of the user agent?

The size of the DIV is set in the CSS and the size of the IFRAME is set in the HTML.

Something like this...

<iframe height="[(document.documentElement)?document.documentElement.offsetHeight:document.body.clientHeight;] width="[(document.documentElement)?document.documentElement.offsetWidth:document.body.clientWidth;] name="body">

etc., etc., etc.

Khalid Ali
06-05-2003, 06:01 PM
You should be able to do that fairly easily.
As you already know how to get the page size and stuff..

just do this..in html declare iframe with only name or id attribute.

<iframe name="iFrame">

now in the javascript section(make sure you call this method once page has been loaded)

var frmObj = document.getElementsByName("iFrame)[0];

//now you have reference to that frame

frmObj.width= width here
frmObj.height=height here