Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vertical alignment of iframe

Status
Not open for further replies.

arunrr

Programmer
Oct 2, 2009
103
US
Please the following cricket world cup schedule page...


Depending on the selection, the number of items (matches) that display in the cell titled "Schedule" varies. You may click any link under Team/Venues/Matches see the functionality.

One of the <a> tags for example is...
<a href="#" ONCLICK="document.getElementById('HTMLfile').innerHTML='<iframe width=100% height=320 marginwidth=0 marginheight=0 frameborder=0 src=/WC/schedule_zz.html></iframe>';return false;">Australia</a>

Here I have set height=320. Depending on the selection, this has to vary for the list to be centered in the cell.

How can I set the height of the iframe so that it dynamically adjusts based on the number of item in the displaying html?

Thanks
Arun
 
For that kind of thing I would look into VB script, as I doubt HTML, CSS or JavaScript can measure the height of text. Not that I have any experience using VB script but it seems like the obvious place to look to me.

[bobafett] BobbaFet [bobafett]
Code:
if not Programming = 'Severe Migraine' then
                       ShowMessage('Eureka!');
 
But for the VBScript suggestion, i dont see any replies to his thread. Firstly, i think my 'subject' is incorrect.

"Vertical alignment of iframe" must actually have been "Height of iframe" to better explain the problem.

Within the <TD></TD> cell, the iframe is centered. So there is no issue there. The challenge is in defining the height because the htmls that can be displayed vary in size.

The "height" attribute to the <iframe> tag does not work as i have tried 'height=100%'.

Thanks,
AR
 
This will undoubtedly require JS. Warning though, the JS will only be able to ascertain the content's height if the content is in the same domain as the iframe's parent page, otherwise Js has no access to the iframe's content properties.


This should point you in the right direction.





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top