div滚动条位置的问题 如何判断div的滚动条是不是在最底部 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 div 有这么3个属性:scrollTop: 滚动条距上边的距离,也就是实际滚动的距离scrollHeight: 这个div如果把滚动的部分展开总距离是多少。clientHeight: 客户端高度, 也就是你看得见的高度, 看不见的就得靠滚动了scrollHeight = clientHeight + scrollTop.靠这个关系就可以搞定了。给你个例子:<div style="width:100%; height: 300px; border: solid red 1px; overflow: scroll" onclick="alert(this.scrollTop);alert(this.scrollHeight);alert(this.clientHeight);"> hellol<br>hellol<br>hellol<br>hellol<br> hellol<br>hellol<br>hellol<br>hellol<br> hellol<br>hellol<br>hellol<br>hellol<br> hellol<br>hellol<br>hellol<br>hellol<br> hellol<br>hellol<br>hellol<br>hellol<br> hellol<br>hellol<br>hellol<br>hellol<br></div> 这个东西我也是刚刚研究了一下, 你找个dhtml.chm参考手册就可以了, 我的资源里面有。 看看一个标签有什么属性, 然后就是试验, 一会儿就试出来了 if(pixelHeight + scrollTop >= scrollHeight){ alert("到底了~");}else{ alert("未到底~");} java调用打印机打印问题求解 为什么文件下载打开的时候还是调用本地软件打开,不在ie里打开 请问高手,做这样一个付费平台需要什么样的技术,大概应该拿多少钱? 如何将一个ArrayList对象跨页面进行传递!! java中如何把一个目录下的文件移到另一个指定的目录? 请教时间比较的问题 SERVLET 不能运行! applet简单问题,在线等,up有分~~~~~ 服务器的配置问题! jsp与tomcat合作 hibernate 关联 关系 我非常疑惑 iframe 如何使引入的页面与其边框对齐
scrollTop: 滚动条距上边的距离,也就是实际滚动的距离
scrollHeight: 这个div如果把滚动的部分展开总距离是多少。
clientHeight: 客户端高度, 也就是你看得见的高度, 看不见的就得靠滚动了
scrollHeight = clientHeight + scrollTop.
靠这个关系就可以搞定了。
给你个例子:<div style="width:100%; height: 300px; border: solid red 1px; overflow: scroll"
onclick="alert(this.scrollTop);alert(this.scrollHeight);alert(this.clientHeight);">
hellol<br>hellol<br>hellol<br>hellol<br>
hellol<br>hellol<br>hellol<br>hellol<br>
hellol<br>hellol<br>hellol<br>hellol<br>
hellol<br>hellol<br>hellol<br>hellol<br>
hellol<br>hellol<br>hellol<br>hellol<br>
hellol<br>hellol<br>hellol<br>hellol<br>
</div>
alert("到底了~");
}else{
alert("未到底~");
}