当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery获得document和window对象宽度和高度的方法教程

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

2019年05月17日  | 移动技术网IT编程  | 我要评论
本文实例讲述了jquery获得document和window对象宽度和高度的方法。分享给大家供大家参考。具体如下: <!doctype html> <

本文实例讲述了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>

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网