*{margin:0;padding:0;}
html,body{margin:0;padding:0;}
body{width:100%;height:2500px;}
.div1{width:100px;height:100px;top:200px;background:#fcc;position:fixed;}
var oHeight,timer,speed;
function Go(){
timer=setInterval("goTo()",1);
}
function goTo(){
oHeight=document.documentElement.scrollTop || document.body.scrollTop;
oHeight+=10;
if(oHeight<1500){ //应该判断在oHeight加之后是大于还是小于
window.scrollTo(0,oHeight);
}
else{
clearInterval(timer);
}
}
html,body{margin:0;padding:0;}
body{width:100%;height:2500px;}
.div1{width:100px;height:100px;top:200px;background:#fcc;position:fixed;}
var oHeight,timer,speed;
function Go(){
timer=setInterval("goTo()",1);
}
function goTo(){
oHeight=document.documentElement.scrollTop || document.body.scrollTop;
oHeight+=10;
if(oHeight<1500){ //应该判断在oHeight加之后是大于还是小于
window.scrollTo(0,oHeight);
}
else{
clearInterval(timer);
}
}