本文实例讲述了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>
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论