PDA

View Full Version : access to <iframe>


whackaxe
06-23-2002, 05:04 PM
how do i access the iframe object and particuly the width and height properties of the latter. i have tried

window.ifrm_name.width = 20
window.ifrm_name.height = 20

whackaxe
06-23-2002, 05:31 PM
i think i will rephrase my question to anybody who reads this: how do i change the height and width of an IFRAME object. this Iframe is used as the navigation window in a chromeless window. i need to change the values when the user resizes the window. i dont have ahost for the minute so i cant show the script to you sorry :p

whackaxe
06-23-2002, 05:40 PM
yes but in the yourfunc that is called by on resize, i needto resize the iframe thats what i'm getting at. does it ake a differnece if the url of the src of the iframe is outside my domain? thanks fer your patience

jkd
06-23-2002, 06:35 PM
refToIframe.style.width = '400px';
refToIframe.style.height = '300px';

Is what I would assume.

whackaxe
06-23-2002, 09:17 PM
sorry but that doesnt work. i have used
document.idoc.style.width = "700px" (where idoc is the name of the iframe)
and it doesnt seem to be working.

jkd
06-23-2002, 10:28 PM
Dave, I preferably use:

document.getElementsByTagName('iframe').item(X)

Where X is the offset, or

document.getElementsByName(MyName).item(0)

where MyName is the name of of the iframe.

I do this mainly because I am trying to shy away from DOM0 scripting whenever possible, and since the only browsers that support <iframe>'s also support those methods (except for IE4, in which case document.all.tags('iframe')[X] works fine). :)

Just another possible way of accessing them ;).