js 获取屏幕高度(监听)
一来就运行
window.onload=function(){
var w=document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;
console.log(w);
var iframe = document.getElementById('item1')
iframe.style.height = (w - 167) + 'px';
}
监听屏幕改变
window.onresize=function(){
var w=document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;
console.log(w);
var iframe = document.getElementById('item1')
iframe.style.height = (w - 167) + 'px'
; }
网友评论