View Full Version : Resizing according to screen dimensions

06-13-2007, 09:40 PM
I've made a script to resize certain elements of my page according to how much of the window is available.

It uses absolute positioning.

function resize(){
var height=document.documentElement.clientHeight;
var width=document.documentElement.clientWidth;


I'm getting this error.

document.getElementById("spare") has no properties
Line 26

The element is an iframe, and if needed I can provide more code, but in the meantime, I'm getting some kip!

Thanks for reading this thread, farewell.

06-13-2007, 10:05 PM
Does the iframe have an id of "spare"?

06-14-2007, 09:28 AM

<iframe src="blank.html" id="spare" frameborder="0" style="position:absolute; bottom:0px; right:0px;"></iframe>

06-14-2007, 10:09 AM
The element does exist once the page has loaded, so I think that when resize(); is called onload, the iframe hasn't been created yet, so has no properties.

Would this me likely?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum