

这是一个比较简单问题,在学习中遇到了,把它写了下来。
代码如下:
function go() {
var sp1 =document.getElementById("sp1");
var btn1 = document.getElementById("start");
if(!btn1.disabled){
btn1.disabled = true;
document.getElementById("pause").disabled=false;
}
sp1.innerHTML=parseInt(sp1.innerHTML)+1;
timenum = window.setTimeout(go,10);
if(flag==1){
window.setTimeout(moveleft,10);
}
if(flag==0){
window.setTimeout(moveright,10);
}
if(mar>(window.outerWidth)){
flag=1;
}
if(mar<0){
flag=0;
}
}
function stop(){
document.getElementById("start").disabled = false;
document.getElementById("pause").disabled=true;
window.clearTimeout(timenum);
}
script>
