菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>小鸟启蒙(facesoho.com)</title> <script> function myFunction(){ var w=window.outerWidth; var h=window.outerHeight; var txt="窗口大小:宽度=" + w + ", 高度=" + h; document.getElementById("demo").innerHTML=txt; } </script> </head> <body onresize="myFunction()"> <p>尝试调整浏览器的窗口</p> <p id="demo"> </p> <p>注意:该例子在IE8 或更早版本下可能不工作,IE8 或更早的版本不支持window对象的outerWidth/outerHeight属性</p> </body> </html>
运行结果