当前位置:Gxlcms > JavaScript > 浏览器窗口加载和大小改变事件示例

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

时间:2021-07-01 10:21:17 帮助过:16人阅读

代码如下:
  1. <br>window.onload = function() { <br>var height = document.body.clientHeight; <br>document.getElementById("vivS").style.height = (height - 20) + "px"; <br>document.getElementById("emd").style.height = (height - 20) + "px"; <br>document.getElementById("ob").style.height = (height - 20) + "px"; <br>}; <br><br>window.onresize = function() { <br>height = document.body.clientHeight; <br>document.getElementById("vivS").style.height = (height - 20) + "px"; <br>document.getElementById("emd").style.height = (height - 20) + "px"; <br>document.getElementById("ob").style.height = (height - 20) + "px"; <br>}; <br>

人气教程排行