上大王 通过本文主要向大家介绍了jQuery,获得,document,window,对象,宽度,高度,方法等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
本文实例讲述了jQuery获得document和window对象宽度和高度的方法。分享给大家供大家参考。具体如下:
<!DOCTYPE html> <html> <head> <script src="js/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ var txt=""; txt+="Document width/height: " + $(document).width(); txt+="x" + $(document).height() + "\n"; txt+="Window width/height: " + $(window).width(); txt+="x" + $(window).height(); alert(txt); }); }); </script> </head> <body> <button>Display dimensions of document and window</button> </body> </html>
希望本文所述对大家的jQuery程序设计有所帮助。