[javascript] <!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body style="height:700px;"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script> document.write($(window).width()+"===浏览器时下窗口可视区域宽度===$(window).width()<br>"); document.write($(window).height()+"===浏览器时下窗口可视区域高度===$(window).height()<hr>"); document.write($(document).width()+"===浏览器时下窗口文档对于象宽度===$(document).width()<br>"); document.write($(document).height()+"===浏览器时下窗口文档的高度===$(document).height()<hr>"); document.write($(document.body).width()+"===浏览器时下窗口文档body的高度===$(document.body).width()<br>"); document.write($(document.body).height()+"===浏览器时下窗口文档body的高度===$(document.body).height()<hr>"); document.write($(document.body).outerWidth(true)+"===浏览器时下窗口文档body的总宽度 包括border padding margin===$(document.body).outerWidth(true)<br>"); document.write($(document.body).outerHeight(true)+"===浏览器时下窗口文档body的总高度 包括border padding margin===$(document.body).outerHeight(true)<hr>"); document.write($(document).scrollLeft()+"===获取滚动条到左边的垂直宽度===$(document).scrollLeft()<br>"); document.write($(document).scrollTop()+"===获取滚动条到顶部的垂直高度===$(document).scrollTop()<hr>"); </script> </body> </html> [/javascript]
[javascript] <!doctype html> <html> <head> <met