一个有趣的JS
时间:2008-04-18 来源:剑心通明
随机效果文本-定时的从一段文本中随机选择一个字符,改变颜色
ripple text examples by mark boyle email [email protected]
var speed = 20;
var fulltext;
if(navigator.appname == "netscape")
document.write(
);
if (navigator.appversion.indexof("msie") != -1)
document.write(
);
function livetext()
{
fulltext="this is an example of random effect text"
var whichchar=math.round((math.random()*fulltext.length))
switch(whichchar){
case 0:
fulltext = + fulltext.substring(0,1) + + fulltext.substring
(1,fulltext.length);
break;
case fulltext.length:
fulltext = fulltext.substring(0,fulltext.length-1) + + fulltext.substring
(fulltext.length-1,fulltext.length) + ;
break;
default:
fulltext =
fulltext.substring(0,whichchar) + +
fulltext.substring(whichchar,whichchar+1) + +
fulltext.substring(whichchar+1,fulltext.length);
break;
}
if(navigator.appname == "netscape") {
size = "";
document.wds.document.write(size+ + fulltext + );
document.wds.document.close();
}
if (navigator.appversion.indexof("msie") != -1){
wds.innerhtml = + fulltext + ;
wds.style.fontsize=25px
}
settimeout("livetext()",speed);
}
livetext()
相关阅读 更多 +