[JavaScript] jQuery获得document和window对象的宽度和高度 →→→→→进入此内容的聊天室

来自 , 2021-01-12, 写在 JavaScript, 查看 153 次.
URL http://www.code666.cn/view/247d87b0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
  5. </script>
  6. <script>
  7. $(document).ready(function(){
  8.   $("button").click(function(){
  9.     var txt="";
  10.     txt+="Document width/height: " + $(document).width();
  11.     txt+="x" + $(document).height() + "\n";
  12.     txt+="Window width/height: " + $(window).width();
  13.     txt+="x" + $(window).height();
  14.     alert(txt);
  15.   });
  16. });
  17. </script>
  18. </head>
  19. <body>
  20.  
  21. <button>Display dimensions of document and window</button>
  22.  
  23. </body>
  24. </html>
  25.  
  26. //javascript/8126

回复 "jQuery获得document和window对象的宽度和高度"

这儿你可以回复上面这条便签

captcha