attn webmasters: iframes problem

earsjr

Senior member
Sep 25, 2003
234
0
0
I looked on numerous sites to verify <iframe> attributes, and all of them state that either a numerical pixel, or percentage value could be used for the height. But when I try to set the height to 100% (stretch out the iframe according to how much content is there) it won't even show up.

Here's an simple example of the problem:

http://www.asianfailures.com/main.html


any suggestions/known fixes for this problem? Or am I just making (another) stupid mistake...
 

pcthuglife

Member
May 3, 2005
173
0
0
You could stretch it further by adding height=100% to your table and td tags. But as long as your frame src is longer than your frame you're still going to have a vertical scroll bar.
 

earsjr

Senior member
Sep 25, 2003
234
0
0
Originally posted by: pcthuglife
You could stretch it further by adding height=100% to your table and td tags. But as long as your frame src is longer than your frame you're still going to have a vertical scroll bar.

I tried adding height=100% attributes to the table & td tags as well but it didn't do anything. The thing is, I want vertical scroll bars on the MAIN page, not within the iframe itself. I hate having to scroll within a page, and if the resolution is too low, having to scroll again on the containing page...

Any other ideas?

Originally posted by: mAdMaLuDaWg
Works fine in Firefox

Interesting...

 

LongTimePCUser

Senior member
Jul 1, 2000
472
0
76
Google is your friend for problems like this. Search for "iframe height javascript" and you will find the answer.

Here is how to do it.
You can add some javascript to the onload event for the page that changes the iframe height.

Add an id to the iframe tag like this:

<iframe marginwidth="0" scrolling="no" id="news" border=0 frameborder=0 width="95%" src="URL"></iframe>

Define the following function and invoke it in the onload event for the page.
function iFrameHeight() {
h=top.frames['news'].document.body.scrollHeight;
if(document.getElementById){
document.getElementById('news').style.height = h;
}
else if(document.all) {
document.all['news'].style.height = h;
}
}
 

earsjr

Senior member
Sep 25, 2003
234
0
0
Originally posted by: LongTimePCUser
Google is your friend for problems like this. Search for "iframe height javascript" and you will find the answer.

Here is how to do it.
You can add some javascript to the onload event for the page that changes the iframe height.

Add an id to the iframe tag like this:

<iframe marginwidth="0" scrolling="no" id="news" border=0 frameborder=0 width="95%" src="URL"></iframe>

Define the following function and invoke it in the onload event for the page.
function iFrameHeight() {
h=top.frames['news'].document.body.scrollHeight;
if(document.getElementById){
document.getElementById('news').style.height = h;
}
else if(document.all) {
document.all['news'].style.height = h;
}
}

Thanks! I did that google search and there seems to be a lot of options for a workaround. One of them should work (hopefully)