首页 > 编程 > JavaScript > 正文

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

2019-11-20 21:02:09
字体:
来源:转载
供稿:网友
复制代码 代码如下:

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";
};
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表