JavaScript tutorial text Picture scroll up instance code
Marque (500,24, "Icefable1", "Box1left")
var Scrollelem;
var stops tutorial Croll;
var stoptime;
var pretop;
var Leftelem;
var currenttop;
var marqueesheight;
var www.111cn.net
function Marque (width,height,marquename,marquecname) {
try{
Marqueesheight = height;
Stopscroll = false;
Scrollelem = document.getElementById (marquename);
With (Scrollelem) {
Style.width = width;
Style.height = Marqueesheight;
Style.overflow = ' hidden ';
NoWrap = true;
}
Scrollelem.onmouseover = new Function (' Stopscroll = True ');
Scrollelem.onmouseout = new Function (' Stopscroll = False ');
pretop = 0;
currenttop = 0;
StopTime = 0;
Leftelem = document.getElementById (marquecname);
Scrollelem.appendchild (Leftelem.clonenode (true));
Init_srolltext ();
}catch (e) {}
}
function Init_srolltext () {
scrollelem.scrolltop = 0;
SetInterval (' Scrollup () ', 20);
}
function Scrollup () {
if (Stopscroll) return;
Currenttop + 1;
if (currenttop = = marqueesheight+1) {
StopTime + 1;
Currenttop-= 1;
if (StopTime = = (marqueesheight) *4) {//Pause time
currenttop = 0;
StopTime = 0;
}
}else{
Pretop = Scrollelem.scrolltop;
Scrollelem.scrolltop + 1;
if (pretop = = scrollelem.scrolltop) {
Scrollelem.scrolltop = Marqueesheight;
Scrollelem.scrolltop + 1;
}
}
}