jQuery获得document和window对象宽度和高度的方法

时间:2015-03-25    点击:71   

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

Jquery异步提交表单代码分享
jQuery使用toggleClass方法动态添加删除Class样式的方法
jQuery使用CSS()方法给指定元素同时设置多个样式
12306验证码破解思路分享
jQuery获得包含margin的outerWidth和outerHeight的方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved