前端小结(5)---- iframe
iframe对应的div:
<div id="iframezone">
<iframe id="iframe" frameborder='0' scrolling='no' height="0" width="0" onload="autoHeight();"></iframe>
</div>
<li>
<a data-toggle="tab" href="javascript:void(0)" onclick="IframeAddSrc('/Customer/SMSRecord', this)"> 记录 </a>
</li>
点击加载页面到iframe。对应的js:
//iframe自适应高,onload会在iframe没加载完时就触发,所以要加上setTimeout,防止自适应高度出现为零的情况
function autoHeight() {
setTimeout(function () {
var iframe = document.getElementById("iframe");
if (iframe.Document) {//ie自有属性
iframe.style.height = iframe.Document.documentElement.scrollHeight;
} else if (iframe.contentDocument) {//ie,firefox,chrome,opera,safari
iframe.height = screen.availHeight;// $(iframe).contents().find("body").height() + 30;
iframe.width = "100%";//screen.availWidth * 0.97 - 216.4;
}
}, 1);
} function IframeAddSrc(src, obj) {
$.post("/Home/ValidateStatus").done(function (data) {
if (data == undefined || data == null || data.status != "ok") {
return;
} $(".tabActive").removeClass("tabActive");
$(obj).addClass("tabActive");
src = src + (src.indexOf('?') > 0 ? "&r" : "?r") + "=" + Math.random();
$("#iframe").removeAttr("src");
$("#iframe").attr("src", src);
if ($("#iframe").onload)
$("#iframe").onload();
});
}
前端小结(5)---- iframe的更多相关文章
- Web前端安全之iframe
防嵌套网页 比如,最出名的clickhacking就是使用iframe来 拦截click事件.因为iframe享有着click的最优先权,当有人在伪造的主页中进行点击的话,如果点在iframe上,则会 ...
- Web前端之【 iframe 】
iframe基本用法 1.最基本的用法 iframe 标签指定 src <iframe src="demo_iframe_sandbox.htm"></ifram ...
- 移动web前端小结(一)
这段时间做了几个移动项目的前端页面,姑且称之webapp.做这几个项目之前根本没接触过移动端的相关知识,以为和PC端页面没啥区别无非就是尺寸小一点罢了.上手以后发现问题颇多.下面从框架.相关知识点.遇 ...
- 前端 - jquery方式 / iframe +form 方式 上传文件
环境与上一章一样 jquery 方式上传文件: HTML代码 {#html代码开始#} <input type="file" id="img" > ...
- 移动web前端小结
原文地址:http://blog.csdn.net/small_rice_/article/details/22690535 在智能手机横行的时代,作为一个web前端,不会编写移动web界面,的确是件 ...
- 移动web前端小结(一)--摘自小鹿_同学
一.框架 框架:Bootstrap+HTML5 Boilerplate. 两个框架整合到一起可以看一下这位大神的文章:<使用 Bootstrap 和 HTML5 Boilerplate 开始一个 ...
- 前端小结(4)---- 页面加载loding....
/*正在加载*/ function showLoading(elem) { var html = '<div class="loading"><div id=&q ...
- 前端小结(3)---- 添加遮罩层,并弹出div
有如下div: <div id='pop-div' class="pop-box"> <div class="input-group has-info& ...
- Web前端之iframe详解
iframe基本内涵 通常我们使用iframe直接直接在页面嵌套iframe标签指定src就可以了. <iframe src="demo_iframe_sandbox.htm" ...
随机推荐
- kali linux之拒绝服务攻击工具
hping3 几乎可以定制发送任何TCP/IP数据包,用于测试FW,端口扫描,性能测试 -c - 计数包计数 -i - interval wait(uX表示X微秒,例如-i u1000) ...
- Lvs IP负载均衡技术
Lvs集群的通用结构 Lvs集群采用IP负载均衡技术,属于IP层的交换(L4),具有很好的吞吐率.调度器分析客户端到服务器的IP报头信息,将请求均衡地转移到不同的服务器上执行,且调度器自动屏蔽掉服务器 ...
- Ruby 和 OpenSSL CA 证书的问题
作为一个版本控,总是希望保持电脑中各种软件到最新版本. 最近通过 brew 升级 OpenSSL 和 ruby-build 到最新,尤其是 ruby-build 支持最新的 Ruby 2.2.1,新版 ...
- mycat 1.6.6.1 distinct报错问题
以前在mysql5.7上执行如下sql语句没有问题 SELECT DISTINCT u.*,c.content userCategory FROM m_user u LEFT JOIN m_categ ...
- CH5102 Mobile Service
CH5102 Mobile Service 描述 一个公司有三个移动服务员,最初分别在位置1,2,3处.如果某个位置(用一个整数表示)有一个请求,那么公司必须指派某名员工赶到那个地方去.某一时刻只有一 ...
- 一个python 服务器程序性能分析
该服务器为bono,启动11个进程. 1.设置cprofile 在启动服务的总入口设置cprofile if __name__=="__main__": import cProfi ...
- 使用bootstrap-table插件
1.用户提交信息过滤表格内容: a.设置表格查询参数,并在用户提交按钮时候更新表格 <form id="current_table" class="form-inl ...
- html5兼容问题
1.html5对于ie9一下的版本不支持,所以我们可以添加(你可以下载至本地): <!--[if lt IE 9]> <script src="http://cdn.sta ...
- django-获取当前url和ip
1.添加'django.template.context_processors.request', 2.在模板的html中输入 {{ request.path}}{{ request.get_host ...
- js中自执行函数写法
//自执行写法1 (function T(){ alert(1) })() //自执行写法2 var T1=function(){ alert(1) }(); //传值 var para1={a:1; ...