Connecting Tech Pros Worldwide Help | Site Map

Get Frame Size

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 11:24 AM
Olumide -
Guest
 
Posts: n/a
Default Get Frame Size

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!

  #2  
Old July 20th, 2005, 11:24 AM
Fred Snider
Guest
 
Posts: n/a
Default Re: Get Frame Size

Olumide - <50295@web.de> wrote in message news:<3f9daac8$0$201$75868355@news.frii.net>...[color=blue]
> 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![/color]


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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.