html页面中iframe导致JavaScript失效

Posted 寻坑者

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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后面,原因未明


以上是关于html页面中iframe导致JavaScript失效的主要内容,如果未能解决你的问题,请参考以下文章