当前位置:主页 > 网页前端 > JavaScript代码 >

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

时间:2021-02-07 14:47:34 | 栏目:JavaScript代码 | 点击:

复制代码 代码如下:

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";
};

您可能感兴趣的文章:

相关文章