-
iframe自适应高度代码
- var adjustIframe = function (id) {
- var iframe = document.getElementById(id)
- var idoc = iframe.contentWindow && iframe.contentWindow.document || iframe.contentDocument;
- var callback = function () {
- var iheight = Math.max(idoc.body.scrollHeight, idoc.documentElement.scrollHeight); //取得其高
- iframe.style.height = iheight + "px";
- }
- if (iframe.attachEvent) {
- iframe.attachEvent("onload", callback);
- } else {
- iframe.onload = callback
- }
- }
- <iframe id="js_sub_web" width="80%" frameborder="0" scrolling="no" allowTransparency="true" src="http://www.cnblogs.com/rubylouvre/archive/2009/09/15/1566722.html">
- </iframe>
- window.onload = function(){
- adjustIframe("js_sub_web");
- }
-
相关阅读:
Pandas也能轻松绘图,简单而又漂亮
笔试题: 二叉排序数左移k个
补题next_permutation
从HTTP到HTTPS
HTTP首部字段详解
HTTP请求方法及响应状态码详解
HTTP报文格式详解
TCP/IP网络基础
Netty学习笔记
ZooKeeper学习笔记
-
原文地址:https://www.cnblogs.com/goodbeypeterpan/p/4434175.html
Copyright © 2020-2023
润新知