Kenny 2007-8-2 14:06
一个有趣的JS
<p>随机效果文本-定时的从一段文本中随机选择一个字符,改变颜色<br><br><!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <br><html> <br><head> <br><script language="javascript"> <br><!-- <br>function open () {return true;} <br>//--> <br></script> <br><title>ripple text examples by mark boyle email mboil@hotmail.com</title> <br></head> <br><br><body bgcolor=green text="white" bgcolor="green" link="yellow" vlink="yellow" <br>alink="red"> <br><font color="yellow"> <br><br><br><script language="javascript"> <br><br>var speed = 20; <br>var fulltext; <br><br>if(navigator.appname == "netscape") <br>document.write(<layer id="wds"></layer><br>); <br>if (navigator.appversion.indexof("msie") != -1) <br>document.write(<span id="wds"></span><br>); <br><br><br>function livetext() <br>{ <br>fulltext="this is an example of random effect text" <br>var whichchar=math.round((math.random()*fulltext.length)) <br>switch(whichchar){ <br>case 0: <br>fulltext = <font color="red"> + fulltext.substring(0,1) + </font> + fulltext.substring <br>(1,fulltext.length); <br>break; <br>case fulltext.length: <br>fulltext = fulltext.substring(0,fulltext.length-1) + <font color="red"> + fulltext.substring <br>(fulltext.length-1,fulltext.length) + </font>; <br>break; <br>default: <br>fulltext = <br>fulltext.substring(0,whichchar) + <font color="violet"> + <br>fulltext.substring(whichchar,whichchar+1) + </font> + <br>fulltext.substring(whichchar+1,fulltext.length); <br>break; <br>} <br>if(navigator.appname == "netscape") { <br>size = "<font point-size=25pt>"; <br>document.wds.document.write(size+<center> + fulltext + </center></font>); <br>document.wds.document.close(); <br>} <br>if (navigator.appversion.indexof("msie") != -1){ <br>wds.innerhtml = <center> + fulltext + </center><p>; <br>wds.style.fontsize=25px <br> } <br><br>settimeout("livetext()",speed); <br>} <br><br>livetext() <br><br></script> <br><br></font> <br><br></body> <br></html> <br> <br><div>