T
Trevor L.
I have been trying to maintain my site as valid XHTML.
But I find this doesn't validate
<iframe class="c1" id="News" src=""
onload="autoResize('News','table1')"></iframe>
This is because the onload event is not defined for the iframe element
However, it works fine.
autoResize() is this function
function autoResize(id,tname)
{
var newheight =
document.getElementById(id).contentWindow.document.getElementById(tname).clientHeight
document.getElementById(id).style.height = (newheight + 10) + "px"
}
It sets the height of the iframe "News" to the height of "table1" which
exists in news.html.
news.html is loaded into "News" by this:
<button onclick="loadIframe('News','news.html')">Open/Close News of this
Site</button>
Is there an alternative which is valid XHTML?
PS
autoResize() is used elsewhere with different html files loaded into
different iframes. All such html files have a table named 'table1' which
contains the entire content.
Is there a way to obtain the element 'table1' without referring to it
explicitly?
This doesn't work:
document.getElementById(id).contentWindow.document.tables[0].clientHeight
I thought of getElementsByTagname but this is non-standard, isn't it?
But I find this doesn't validate
<iframe class="c1" id="News" src=""
onload="autoResize('News','table1')"></iframe>
This is because the onload event is not defined for the iframe element
However, it works fine.
autoResize() is this function
function autoResize(id,tname)
{
var newheight =
document.getElementById(id).contentWindow.document.getElementById(tname).clientHeight
document.getElementById(id).style.height = (newheight + 10) + "px"
}
It sets the height of the iframe "News" to the height of "table1" which
exists in news.html.
news.html is loaded into "News" by this:
<button onclick="loadIframe('News','news.html')">Open/Close News of this
Site</button>
Is there an alternative which is valid XHTML?
PS
autoResize() is used elsewhere with different html files loaded into
different iframes. All such html files have a table named 'table1' which
contains the entire content.
Is there a way to obtain the element 'table1' without referring to it
explicitly?
This doesn't work:
document.getElementById(id).contentWindow.document.tables[0].clientHeight
I thought of getElementsByTagname but this is non-standard, isn't it?