//FILE: scrolltext.js CREATED: DannyKang @ 2004-5-19
var stopscroll=false;
var preTop=0;
//var newTop=0;
var currentTop=0;
var stoptime=0;
var iInterval ;
function init_srolltext(){
document.body.scrollTop=0;
document.body.onmouseover = new Function("stopscroll=true");
document.body.onmouseout = new Function("stopscroll=false");
document.body.oncontextmenu = new Function("return false;");
document.body.onselectstart = new Function("return false;");
iInterval = setInterval("scrollUp()",25);
}
function scrollUp(){
if(stopscroll==true) return;
currentTop+=1; //每次滚动 1 个象素
if(currentTop==24){ //刚滚动完一行后(每行高23)
stoptime+=1; //停顿时间累计 1 个单位时间(25毫秒)
currentTop-=1; //滚动位移数恢复原值
if(stoptime==100){ //停顿时间累计 100 个单位时间后重新计算滚动位移和停顿时间
currentTop=0;
stoptime=0;
//if(confirm("One line end ...... \n\nok to stop , cancel to go on.")){clearInterval(iInterval);}
}
}else{
document.body.scrollTop = preTop +1; //滚动 1 个象素
if(preTop< document.body.scrollTop){
preTop = document.body.scrollTop ;
}
else {//如果滚动到末尾了(滚动跟没滚一样)
preTop = 1
document.body.scrollTop = 1;
//if(confirm("scroll to all text ending.......["+preTop+"/"+document.body.scrollTop+"] \n\nok to stop , cancel to go on.")){clearInterval(iInterval);}
}
}
}