浏览器窗口加载和大小改变事件示例

内容摘要
复制代码 代码如下: window.onload = function() { var height = document.body.clientHeight; document.getElementById("vivS").style.height = (height - 20) + "px"; do
文章正文
复制代码 代码如下:

window.onload = function() {
var height = document.body.clientHeight;
document.getElementById("vivS").style.height = (height - 20) + "px";
document.getElementById("emd").style.height = (height - 20) + "px";
document.getElementById("ob").style.height = (height - 20) + "px";
};

window.onresize = function() {
height = document.body.clientHeight;
document.getElementById("vivS").style.height = (height - 20) + "px";
document.getElementById("emd").style.height = (height - 20) + "px";
document.getElementById("ob").style.height = (height - 20) + "px";
};

代码注释

作者:喵哥笔记

IDC笔记

学的不仅是技术,更是梦想!