js 判断 html是否到最底部
大家有谁做过这样的吗,求源码。
大概就是用js判断html页面是否滚动到最底部了。
[解决办法]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title></head><body > <div style="margin-top: 1px; background-color: red;" onclick="ec();"> a 1x</div> <div style="margin-top: 800px; background-color: red;" onclick="ec();"> b 800x</div> <div style="margin-top: 1600px; background-color: red;" onclick="ec();"> c 1600x</div><script type="text/javascript"> window.onscroll = function () { var a = document.documentElement.scrollTop == 0 ? document.body.clientHeight : document.documentElement.clientHeight; var b = document.documentElement.scrollTop == 0 ? document.body.scrollTop : document.documentElement.scrollTop; var c = document.documentElement.scrollTop == 0 ? document.body.scrollHeight : document.documentElement.scrollHeight; if (b != 0) { if (a + b == c) { showmore(); } } } function showmore() {alert('aa');}</script></body></html>