html页面中iframe导致JavaScript失效

<body onload=“reset()”
>   <div id="part1"> some thing here ....   <div>   <ifame src="xxxx"/>   <script>   function reset(){   var height = window.innerHeight; document.getElementById("part1").style.minHeight = height+"px";     }   </script> </body>

在一个html页面中,通过iframe包含另一个页面的时候,导致onload=“reset()”失效

解决:把<iframe>移到script后面,原因未明

原文地址:https://www.cnblogs.com/dannyyao/p/6343909.html