jQuery获得document和window对象宽度和高度的方法
jQuery获得document和window对象宽度和高度的方法
发布时间:2016-12-30 来源:查字典编辑
摘要:本文实例讲述了jQuery获得document和window对象宽度和高度的方法。分享给大家供大家参考。具体如下:$(document).r...

本文实例讲述了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程序设计有所帮助。

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类