Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Get Frame Size

Reply
Thread Tools

Get Frame Size

 
 
Olumide -
Guest
Posts: n/a
 
      10-27-2003
How can javascript be used to get the size of a Frame in a document.

Thanks

- Olumide


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Fred Snider
Guest
Posts: n/a
 
      10-28-2003
Olumide - <(E-Mail Removed)> wrote in message news:<3f9daac8$0$201$(E-Mail Removed)>...
> How can javascript be used to get the size of a Frame in a document.
>
> Thanks
>
> - Olumide
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get content from one frame into another frame Fokke Nauta HTML 3 04-29-2009 09:19 AM
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
How to make change one frame size (width) when I clicked a button on anothoer frame? ABC ASP .Net 0 06-28-2006 03:37 AM
Manipulating control in one frame from another frame, how? Søren M. Olesen ASP .Net 0 11-13-2003 05:37 PM



Advertisments