473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Determine the height and width of a frame.

dmjpro
2,476 2GB
Suppose i have a HTML file like this....
Expand|Select|Wrap|Line Numbers
  1. <frameset rows="10%,*">
  2. <frame name="frame1" src="page1"/>
  3. <frame name="frame2" src="page2"/>
  4. </frameset>
  5.  
Now my page1 is like this ..
Expand|Select|Wrap|Line Numbers
  1. <frameset cols="50%,*">
  2. <frame name="frame1" src="page3"/>
  3. <frame name="frame2" src="page4"/>
  4. </frameset>
  5.  
Now my page2 is like this ...
Expand|Select|Wrap|Line Numbers
  1. <frameset cols="50%,*">
  2. <frame name="frame1" src="page5"/>
  3. <frame name="frame2" src="page6"/>
  4. </frameset>
  5.  
Now page3,page4 contain the view part .......
If i want to determine the height and width of any frame ..then how could i get that?
It is possible what i think ..that is by back calculation ..means using the percentage value of each frame and having the top window width and height, we can do it ....
But is there any direct API by which i can get the height and width easily of any frame ?
Any help would be appreciated .... :)
Sep 26 '08 #1
9 5126
dmjpro
2,476 2GB
I found the solution and managed the full fill the target.
Basically it is possible with window.innerHeight and window.innerWidth.
Sep 26 '08 #2
acoder
16,027 Expert Mod 8TB
I don't usually (ever?) work with frames, but this link may help.

Edit: didn't realise you'd already posted. I'm not sure if innerHeight/Width always gives reliable results. You may want to test just in case.
Sep 26 '08 #3
gits
5,390 Expert Mod 4TB
hi ...

you may ask an element for its current or computed style ... have a look here at the section where the 'getStyle()' method is described ...

kind regards
Sep 26 '08 #4
dmjpro
2,476 2GB
Gits and Acoder!
Basically my solution works with Mozilla only ...trying to find out the IE compatibility. What i trying to do i m setting the cols or rows according to the current resolution so that it shows the appropriate result at each screen resolution. That's why i need to have the window height and width ..i mean the screen width and height not the actual one .... ;)
now ..... window.screen.height and width only gives the width and height of top screen.... :(
Sep 26 '08 #5
dmjpro
2,476 2GB
I don't usually (ever?) work with frames, but this link may help.

Edit: didn't realise you'd already posted. I'm not sure if innerHeight/Width always gives reliable results. You may want to test just in case.

Acoder I looked at your prescribed link there i found my solution ..basically i was on the right track but i did a little bit wrong .... ;)
Actually i am having a main page contains two frames .....like this ....

Expand|Select|Wrap|Line Numbers
  1. <frameset cols="50%,*">
  2. <frame src="page1"/>
  3. <frame src="page2"/>
  4. </frameset>
  5.  
Now page1 and page2 contains some view part .... having the window reference of page1 or page2 what i did earlier ...i was retrieving the screen height and screen width using window.ducument.body.clientWidth and clientHeight. But it shown me the actual height and width what window acquired .... But what i needed to do .... i should have used .. parent.document.clientWidth or clientHeight

I think it fulfills my target ..... what you say ?
Would there any be help for me ?
Sep 26 '08 #6
dmjpro
2,476 2GB
I am still having the problem .... Without testing i told that i found the perfect solution.
See ......
I have the starting page ....

Expand|Select|Wrap|Line Numbers
  1. <frameset rows="50%,*">
  2. <frame src="test.html"/>
  3. <frame src="another_frame.html"/>
  4. </frameset>
  5.  
Now another_frame.html is ..

Expand|Select|Wrap|Line Numbers
  1. <frameset cols="50%,*">
  2. <frame src="test.html"/>
  3. <frame src="main_page.html"/>
  4.  
Now main_page.html is ...

Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script type="text/javascript">
  3. function test(){
  4.     alert(parent.document.body.clientWidth);
  5. }
  6. </script>
  7. </head>
  8.  
  9. <body onload=test()></body>
  10.  
It still getting the same result .... i want to have how much screen area acquired by the another_frame.html page. It is supposed to result the half of the total width of the top screen..... Could you help me to solve this problem.

Thanks!
Sep 26 '08 #7
gits
5,390 Expert Mod 4TB
did you try the getComputedStyle()/currentStyle solution that you may find in the link i already showed you?
Sep 26 '08 #8
dmjpro
2,476 2GB
did you try the getComputedStyle()/currentStyle solution that you may find in the link i already showed you?
Gits i could not figure out anything..please will you help me to do ....
Above I mentioned my problem ..... ;)
Thanks!
Sep 27 '08 #9
dmjpro
2,476 2GB
did you try the getComputedStyle()/currentStyle solution that you may find in the link i already showed you?

Sorry Acoder and Gits!
Finally i tested the code and thought a lot before posting ...
I found the solution ......
I am getting the desired output using parent.document.body.offsetWidth/Height

Thanks all ... !!!!
Sep 27 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: W Dean | last post by:
Hi, I'm have a problem with defining the height of of two different div's (one containing text and another containing a picture) on a site I'm designing. Basically, the height appears to be the...
3
by: Ernst | last post by:
I have a script for a menu. However, this menu uses absolute coordinates. This menu had to be placed on a website. This website is position (centered) using a table. How can I determine/calculate...
2
by: cschang | last post by:
I am not sure this is the right place to ask this question. I have a web page composed with two frames (left and right). Then in my frmae2(right one) , I open a pop-up window by javscript:...
3
by: coolsti | last post by:
I need some help here. I am making an application which allows a user to look at a series of picture files one at a time, and enter the outcome of various visual tests to a database. The...
9
by: Adam | last post by:
Can someone please help!! I am trying to figure out what a font is? Assume I am working with a fixed font say Courier 10 point font Question 1: What does this mean 10 point font Question 2:...
5
by: Eric | last post by:
Given System.Web.UI.Control Control Can I determine the height of Control without knowing specifically what it is?
1
by: pankaj17 | last post by:
hello, I want to find out the height and width of right frame in iframe that is included in left frame. main.html <html> <frameset cols="15%, *" id="fs1"> <frame src="left.html" name="left"...
23
by: shashi shekhar singh | last post by:
Dear sir, I have a word document file contains text and images, now i have saved it as a web page and wants to display it on browser , using , string str=directory.getfiles("");...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.