您好,欢迎访问一九零五行业门户网

在JavaScript中,onresize事件的用途是什么?

当窗口调整大小时,会触发resize事件。在javascript中使用 window.outerwidth和window.outerheight事件来获取浏览器调整大小时的窗口大小。
示例你可以尝试运行以下代码来使用javascript中的onresize事件。
<!doctype html><html> <head> <script> function resizefunction() { var val = "window width=" + window.outerwidth + ", window height=" + window.outerheight; document.getelementbyid("test").innerhtml = val; } </script> </head> <body onresize="resizefunction()"> <p>resize browser window and check the window (browser window) height and width again.</p> <p id = "test"> </p> </body></html>
以上就是在javascript中,onresize事件的用途是什么?的详细内容。
其它类似信息

推荐信息