文字周围闪烁特效的实现 dn001 2009-06-21 08:30:54 <!-- 完整的HTML代码如下: --> <html> <HEAD> <SCRIPT LANGUAGE="JavaScript"> var outMsg = ""; var i = 0; var lineNo = 1; var timerDM=null; var msg = " "; function araVob() { } var ScreenLine = new araVob(); ScreenLine[1] = "welcome to knowsky.com" ScreenLine[2] = "All the free technology you can handle" ScreenLine[3] = "You Can also visit" ScreenLine[4] = "http://www.knowsky.com" ScreenLine[5] = "Please keep submitting" ScreenLine[6] = "Let us know what you think" ScreenLine[7] = "Thanks Alot" ScreenLine[8] = " Happy !!" var msgNum = 1; var msgCnt = 8; var typeSpeed = 200; var pageLen = 4; var delay=typeSpeed; var r = 0; var cr="rn" if ("3" <=navigator.appVersion.charAt(0)) { var cr="n" } for (x = 1; x<=(msgCnt); x++) { ScreenLine[x] = ScreenLine[x] + cr; } msg = ScreenLine[1]; function DisplayMsg() { if (msg.length <= i || msg.charAt(i) == "f") { r=i; i=0; ChangeMsg(); } outMsg = outMsg + msg.charAt(i); i++; if (msg.charAt(i) == "f" || (lineNo == pageLen && i==msg.length)) { delay = 4000; } else { if (msg.charAt(i) == cr && msg != " "+cr) { delay = 2000; } else { delay = typeSpeed; } } self.document.forms[0].elements[0].value=outMsg; timerDM = setTimeout("DisplayMsg()",delay); } function ChangeMsg() { msgNum++; if (msgCnt < msgNum) { msgNum = 1; } lineNo++; if (pageLen < lineNo || msg.charAt(r) == "f") { outMsg=ScreenLine[msgNum].charAt(i); i++; lineNo = 1; } msg = ScreenLine[msgNum]; } // End --> </script> </HEAD> <BODY> <FORM NAME= "msgform" ACTION=""> <input type="button" value="点击这里查看" onClick="DisplayMsg()"> </FORM> </body> </html>