Javascipt中documentHeight,windowHeight的含义

来源:互联网 发布:好莱坞演技 知乎 编辑:程序博客网 时间:2024/06/05 14:27

html常见的documentHeight,windowHeight含义,一般用于实现滚动刷新的效果

HTML正文:

<input type="button" value="测试" onclick="test()"/><br>documentHeight:<span id="documentHeight"></span><br>windowHeight:<span id="windowHeight"></span><br>

Javascript操作代码:

<script type="text/javascript" src="js/jquery-1.3.1.js"></script><script type="text/javascript" src="js/avalon.js.js"></script>function test(){    var documentHeight=$(document).height();  //文档的高度    $("#documentHeight").html(documentHeight);    var windowHeight=$(window).height(); //浏览器窗口可视化的高度    $("#windowHeight").html(windowHeight);}

效果:
这里写图片描述

0 0
原创粉丝点击