您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

jsp页面iframe高度自适应的js代码

2024/2/18 17:10:24发布53次查看
以下操作写在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代码。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product