What is used is that when the iframe nested page is loaded, use the onload event to get the height of the web page nested in the iframe, and then assign it to the Iframe. Just the height.
When the main page and the nested iframe have different domain names, it is a little more troublesome and you need to avoid JavaScript's cross-domain restrictions.
Principle: There are three existing iframe main pages main.html, iframe nested pages iframe.html, and iframe intermediary page agent.html, which are embedded through main.html (domain name is http://www.ccvita.com) Set iframe.html (domain name: http://www.phpq.net), when the user browses, execute the JavaScript code in iframe.html to set the height of the iframe page added to the scr address of iframeC, agent.html (domain name: http://www.ccvita.com) obtains the passed height and sets the height of the iframe in main.html through JavaScript. Finally achieve the desired goal.
iframe main page main.html
[code]
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 .org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< ;title>iframe main page
< ;iframe id="frame_content" name="frame_content" src="iframe.html" width="100%" height="0" scrolling="no" frameborder="0">
Tail
Iframed page
Text< ;br />
Text
< ;br />
Text
Text
< ;script type="text/javascript">
function sethash(){
hashH = document.documentElement.scrollHeight;
urlC = "agent.html";
document.getElementByIdx("iframeC ").src=urlC "#" hashH;
}
window.onload=sethash;