跟着写的为什么不对那
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="scrolldiv"></div>
<style type="text/css">
.scrolldiv{
width: 500px;
height: 400px;
margin: 1000px auto 100px auto;
background-color: red;
}
</style>
<script type="text/javascript">
function scrllB(){
var clients=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
var scrollTop=document.body.scrollTop;
var whHeight=document.body.scrollHeight;
if(clients+scrollTop>=whHeight){
alert("到底部了")
}
if(scrollTop==0){
alert("顶部")
}
}
window.onscroll=scrllB;
</script>
</body>
</html>