荧光文字

要完成此效果把如下代码加入到

 1<body>区域中 
 2
 3<h2>
 4<script language="JavaScript1.2">
 5
 6//下面设置显示效果的属性   
 7var message="Welcome to JavaScript Fairyland!"   
 8var neonbasecolor="gray"   
 9var neontextcolor="33ff33"   
10var flashspeed=100 //in milliseconds 
11
12///No need to edit below this line///// 
13
14var n=0   
15if (document.all){   
16document.write('<font color="'+neonbasecolor+'">')   
17for (m=0;m<message.length;m++)   
18document.write('<span id="neonlight">'+message.charAt(m)+'</span>')   
19document.write('</font>') 
20
21//cache reference to neonlight array   
22var tempref=document.all.neonlight   
23}   
24else   
25document.write(message) 
26
27function neon(){ 
28
29//Change all letters to base color   
30if (n==0){   
31for (m=0;m<message.length;m++)   
32tempref[m].style.color=neonbasecolor   
33} 
34
35//cycle through and change individual letters to neon color   
36tempref[n].style.color=neontextcolor 
37
38if (n<tempref.length-1)   
39n++   
40else{   
41n=0   
42clearInterval(flashing)   
43setTimeout("beginneon()",1500)   
44return   
45}   
46} 
47
48function beginneon(){   
49if (document.all)   
50flashing=setInterval("neon()",flashspeed)   
51}   
52beginneon() 
53
54  
55</script>
56</h2></body>
Published At
Categories with 网页设计
Tagged with
comments powered by Disqus