var frame = document.getElementById('#frame'),
win = frame.contentWindow,
doc = win.document,
html = doc.documentElement,
body = doc.body;
// 获取高度
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
frame.setAttribute('height', height);
win = frame.contentWindow,
doc = win.document,
html = doc.documentElement,
body = doc.body;
// 获取高度
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
frame.setAttribute('height', height);
本文介绍如何使用JavaScript获取网页元素的高度,并据此调整框架的大小,实现响应式布局。
1776

被折叠的 条评论
为什么被折叠?



