close

漸層文字

<DIV id="fade" style="width:350px; text-align:center;"></DIV>
<SCRIPT Language="JavaScript">
function fadetext() {
fade.style.filter="alpha(opacity="+x+", style=0)";
x=((y<50)?x+4:x-4); y+=2;
if(y==100) {
z=((z>=texts.length-1)?0:z+1); y=0;
fade.innerHTML=texts[z]; fade.style.color=tcolor[z];
}
setTimeout("fadetext();", 100);
//數字是變化後顯示下一個文字的時間,10代表0.1秒
}
var texts=new Array(4), tcolor=new Array(4), x=0, y=0, z=0;
//這裏是文字的段落數目及各段的顏色,兩個數字要配合
texts[0]="歡迎光臨!";
texts[1]="小林工作室";
texts[2]="這是文字特效";
texts[3]="漸層變色文字特效";
tcolor[0]="red";
tcolor[1]="green";
tcolor[2]="blue";
tcolor[3]="#ffff00";
//這裏是文字及顏色要修改的地方
fade.innerHTML=texts[z]; fade.style.color=tcolor[z];
window.onload=fadetext;
</SCRIPT>
arrow
arrow
    全站熱搜

    nicole 發表在 痞客邦 留言(0) 人氣()