"Improved" JavaScript implementation of rolling text effect

zhaozj2021-02-16  58

/ * This program is improved in accordance with a version of 21CN. * The idea of ​​the original version is: generate a form in a layer of only one line, then use * Table scrolltop to implement progressive scrolling. But this method can only run normally in IE, which cannot scroll in Mozzila. * Improve the use of iframe instead of the original layer, use the body's scrolltop to implement scrolling. * Btw: Dannykang is my English name. * /

// file: scrolltext.js created: dannykang @ 2004-5-19var stopscroll = false; var pretop = 0; // var newtop = 0; var currenttop = 0; var stoptime = 0; var =ter;

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.onselectionStart = new function ("Return False;"); interval = setInterval ("scrollup ()", 25);}

Function scroll () {if (stopscroll == true) return; currenttop = 1; // Scroll 1 pixel IF each time (CurrentTop == 24) {// After rolling up line (23) StOptime = 1; // Time Time Cumulative 1 unit time (25 milliseconds) Currenttop- = 1; // Rolling displacement number Restore the original value IF (stoptime == 100) {// Stop time Cumulative 100 unit time Reconscute Rolling Displacement And pause time currenttop = 0; stopTime = 0; // IF ("One line end ... / n / nok to stop, can go on.")) {ClearInterval (IINTERVAL);}} } else {document.body.scrolltop = pretop 1; // Scroll 1 pixel IF (Pretop

/ * Call page iframe write * /