Get Frame Size

O

Olumide -

How can javascript be used to get the size of a Frame in a document.

Thanks

- Olumide
 
F

Fred Snider

Olumide - said:
How can javascript be used to get the size of a Frame in a document.

Thanks

- Olumide


Here is the code I use. wxsize is the width of the third frame on my
screen, and
wysize is the height of the third frame. The [2] refers to the order
in which the frames were created with the FRAMESET. First one is [0].
This is browser dependent! my variable isNav is true if the browser is
netscape, false if it is IE or Opera

//- browser dependent- no way around it...
function getsize(){
if (isNav){
// frame dimensions in netscape
wysize= (parent.window.frames[2].innerHeight)
wxsize= (parent.window.frames[2].innerWidth)
}else{
// frame dimensions in IE or Opera
wysize= (top.frames[2].document.body.clientHeight)
wxsize= (top.frames[2].document.body.clientWidth)
}
}

Note you have to wait until all frames are loaded before you call
this, otherwise you get garbage. I use a call to this routine in the
last FRAMESET document to get loaded using the body command:: <body
onload="getsize()">

Hope this helps.

Fred
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top