iframe自适应、iframe跨域自适应
来源:互联网 发布:农村淘宝加盟申请 编辑:程序博客网 时间:2024/05/18 18:43
<iframe id="dataLoad" name="dataLoad" scrolling="no" frameborder="no" style="border: 0px;" width="980px" height="600px" marginheight="0" marginwidth="0" frameborder="0" src="http://localhost:8080/projectName/gis.action?pageType='true'&pwd=<s:property value="shUserInfo.xwh" escape="true" />"></iframe>
本域:
/**
/** * iframe自适应加载 * */ function reSetIframe(){ var iframe = document.getElementById("dataLoad"); iframe.height = 200; try{ var bHeight = iframe.contentWindow.document.body.scrollHeight; var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; var height = Math.max(bHeight, dHeight); iframe.height = height+40; }catch (ex){} }
跨域:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <script> function pseth() { var iObj = parent.parent.document.getElementById("dataLoad");//A和main同域,之所以可以访问节点 var iObjH = parent.frames["biframe"].location.href;//访问自个儿的location对象获取hash值 var bHeight = iObjH.split("?")[1];//操作dom iObj.style.height = bHeight + "px"; parent.parent.document.getElementById("container_1000").style.height = (Number(bHeight) + 260)+ "px"; } pseth(); </script> </html>
嵌套页面(iframe其他域下的jsp、action)
<iframe id="biframe" name="biframe" width="100%" src="" style="display:none"></iframe> function sethash(){ var b_height = document.getElementById("mtjy_con").scrollHeight; var b_iframe = document.getElementById("biframe"); b_iframe.src = "http://192.168.1.10:8080/projectName/agent.jsp?"+b_height; } window.onload=sethash;
0 0
- iframe自适应、iframe跨域自适应
- iframe 跨域自适应
- iframe 跨域自适应高度
- Iframe跨域自适应高度
- iframe跨域高度自适应
- iframe跨域自适应高度
- iframe 跨域自适应高度
- iframe自适应与跨域
- iframe跨域自适应高度
- iframe自适应
- iframe 自适应
- 自适应iframe
- iframe 自适应
- iframe自适应
- iframe自适应
- iframe自适应
- iframe自适应
- iframe 自适应
- 位运算用法总结
- Oracle Database之序列(Sequence)
- Gradle文件操作基础
- 《美人鱼》观后感
- HTTP状态码梳理
- iframe自适应、iframe跨域自适应
- ubuntu14.04+CPU环境下搭建caffe,python接口以及运行fast-rcnn实例
- 函数初应用。
- 为UIView添加点击事件
- 关于音频焦点的运用
- 新版Vultr挂载自定义ISO安装Windows XP系统并开启远程桌面教程
- Linux 系统结构详解(一)
- **MYSQL** 数据库注册表文件修改
- 【更新版】域名安全防护智能解析DNS+CDN免费产品