很好的文字效果

- 中國WEB開發者網絡 (http://www.webasp.net)
-- 網頁特效 (http://www.webasp.net/javascript/)
--- 很好的文字效果 (http://www.webasp.net/javascript/1/275.htm)
-- 發佈日期: 2004-07-13
<!-- 網頁特效代碼由[中國WEB開發者網絡:http://www.ChinaWebDev.com]提供! -->
<!-- 要實現此效果需要 1 個步驟: -->

<!-- 第 1 步: -->
<!-- 把下面的代碼加到<BODY></BODY>區域中: -->

<script language="JavaScript">
function assignArray(text,delay) {
this.text=text
this.delay=delay
}
function createArray() {
fadecolor=new Array("FF8000","8080FF","00FF00","00FFFF","008040","CA00CA")

msg=new Array(4)
msg[0]=new assignArray("第一條信息。",1000);
msg[1]=new assignArray("第二條信息。",1000);
msg[2]=new assignArray("第三條信息。",1000);
msg[3]=new assignArray("第四條信息。",1000);

setTimeout("typeIt()", 1000)
}
var msgNo=0
var character=1
var colorNo=0
var fixColor=1
var colorCheck=0
function typeIt() {
var insertHTML=""
if(msgNo <= msg.length-1) {
if(character <= msg[msgNo].text.length || colorCheck < msg[msgNo].text.length) {
colorCheck=0
for(var charCheck=0; charCheck<character; charCheck++,colorNo--,fixColor--){
if(fixColor>5)colorNo=5
if(colorNo==5)colorCheck+=1
insertHTML += '<SPAN style="font-family: Black; font-size:coolboo; color:'+fadecolor[colorNo]+'">' + msg
[msgNo].text.substring(charCheck, charCheck+1) + '</SPAN>'
}
if(document.layers) {
document.typeWriter.document.write(insertHTML)
document.typeWriter.document.close()
} else if (document.all) {
document.all.typeWriter.innerHTML = insertHTML
}
setTimeout("typeIt()", 50)
character++
colorNo=character-1
fixColor=character
}
else {
character=1
colorNo=character-1
fixColor=character
setTimeout("typeIt()", msg[msgNo].delay)
msgNo++
}
}
}
</script>
<body onLoad="createArray()" text="#ffffff">
<div ID="typeWriter" style="position: absolute; left:2; top: 2; width: 601; height: 19"></div>


webasp.net