// JavaScript Document
function startmarquee(lh,speed,delay) {   //函数 函数名(变量1,变量2,变量3)
var p=false; //定义变量 p为假;
var t; //定义变量t了
var o=document.getElementById("marqueebox"); //定义变量o为document.getElementById("marqueebox")对象
o.innerHTML+=o.innerHTML; //设置变量o的innerHTML对象为自加
o.style.marginTop=0; //o的属性，设置或获取对象的上边距宽度
o.onmouseover=function(){p=true;} //光标在滚动字幕范围内暂停滚动
o.onmouseout=function(){p=false;} //光标在滚动字幕范围外也就是离开的时候继续滚动

function start(){ //“开始”函数
t=setInterval(scrolling,speed); //给前面定义的变量t赋值=自动（滚动，速度）
if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; //当P为空，属性o的上边距宽度为数字[把变量o上边距宽度转为integer类型，其中parseInt功能为转换]
}

function scrolling(){ //“滚动”函数
if(parseInt(o.style.marginTop)%lh!=0){ //如果对象o的上边距宽度为空，则为0（parseInt为转换作用）
o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; //上边距宽度为数字[把变量o上边距宽度转为integer类型，其中parseInt功能为转换]
if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2) o.style.marginTop=0; //如果计算出来的上边距宽度大于或者等于滚动的高度除以2 则o的上边距宽度为0
}else{ //否则
clearInterval(t); //指定T为空
setTimeout(start,delay);//指定暂停时间(开始，延迟)
}//相当于end if，表示结束如果
}//相当于end if，表示结束如果

//新的开始，不包含在前面的如果里面
setTimeout(start,delay); //指定暂停时间(开始，延迟)
}
startmarquee(25,25,1000); //滚动属性(滚动高度,速度,延迟
