脚本宝典收集整理的这篇文章主要介绍了jsp页面iframe高度自适应的js代码,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
以下操作写在body里面,form表单外
<iframe id="agentFrame" name="agentFrame" src="" width="0" height="0" style="display:none;" ></iframe> <script tyPE="text/javascript"> function sethash(){ hashH = document.documentElement.scrollHeight; //获取自身高度 urlC = "/test.jsp"; //设置iframeA的src document.getElementById("agentFrame").src=urlC+"#"+hashH; //将高度作为参数传递 } window.onload=sethash; </script>
test.jsp如下:
<%@ page contentType="text/htML;charset=GBK" language="java"%> <script> function pseth() { VAR iObj = parent.parent.document.getElementById('infoFrame'); iObjH = parent.parent.frames["infoFrame"].frames["agentFrame"].location.hash; iObj.style.height = iObjH.splIT("#")[1]+"px"; } window.onload=pseth(); </script>
以上是脚本宝典为你收集整理的jsp页面iframe高度自适应的js代码全部内容,希望文章能够帮你解决jsp页面iframe高度自适应的js代码所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。