为什么我不能清除计时器?
<script type="text/javascript">
window.onload=function(){
var totop=document.getElementById("tab-top");
var clientheight=document.documentElement.clientHeight||document.body.clientHeight;
var scroll=document.documentElement.scrollTop || document.body.scrollTop;
totop.onclick=function clock(){
var i=setInterval(function(){
document.body.scrollTop=document.documentElement.scrollTop-=500;
if (scroll==0) {
clearInterval(i);
}},100);
}
}
</script>