Home > Web Front-end > HTML Tutorial > iframe dynamically changes the height of the embedded page_html/css_WEB-ITnose

iframe dynamically changes the height of the embedded page_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:56:02
Original
1402 people have browsed it

test.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title> New Document </title>  <meta name="Generator" content="EditPlus">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content=""> </head> <body><table align=center cellspacing=0 cellpadding=0 height="100%" border=0><tbody><tr><td valign="top" width="206" name="frametitle" id="frametitle"><iframe style="z-index: 1; visibility: inherit; width: 206px;height:100%" name="leftmenu" id="leftmenu" src="nest.html" frameborder=0  scrolling="no"></iframe></td></tr></tbody></table> </body></html> <script type="text/javascript">function TuneHeight(){	var h = document.getElementById("leftmenu").contentWindow.document.body.scrollHeight + "px";		document.getElementById("frametitle").style.height=h;	}	window.onload=TuneHeight;</script>
Copy after login

nest.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title> New Document </title>  <meta name="Generator" content="EditPlus">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content="">   <script type="text/javascript">   function test(){	document.write("<span>----------------------------------</span>");	window.parent.TuneHeight();   }   setInterval(test,1000);	  </script> </head> <body>   </body></html>
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template