首頁 >web前端 >js教程 >瀏覽器視窗載入和大小改變事件範例_javascript技巧

瀏覽器視窗載入和大小改變事件範例_javascript技巧

WBOY
WBOY原創
2016-05-16 16:58:011154瀏覽
複製程式碼如下程式碼:

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

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn