欢迎光临
我们一直在努力

一个有趣的JS:随机效果文本-定时的从一段文本中随机选择一个字符,改变颜色。可以学习一下JS。-PHP教程,PHP应用

建站超值云服务器,限时71元/月

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<script language="javascript">
<!–
function open () {return true;}
//–>
</script>
<title>ripple text examples by mark boyle email mboil@hotmail.com</title>
</head>

<body bgcolor=green text="white" bgcolor="green" link="yellow" vlink="yellow"  
alink="red">
<font color="yellow">

<script language="javascript">

var speed = 20;
var fulltext;

if(navigator.appname == "netscape")
document.write(<layer id="wds"></layer><br>);
if (navigator.appversion.indexof("msie") != -1)
document.write(<span id="wds"></span><br>);

function livetext()
{
fulltext="this is an example of random effect text"
var whichchar=math.round((math.random()*fulltext.length))
switch(whichchar){
case 0:
fulltext = <font color="red"> + fulltext.substring(0,1) + </font> + fulltext.substring
(1,fulltext.length);
break;
case fulltext.length:
fulltext = fulltext.substring(0,fulltext.length-1) + <font color="red"> + fulltext.substring
(fulltext.length-1,fulltext.length) + </font>;
break;
default:
fulltext =  
fulltext.substring(0,whichchar) + <font color="violet"> +
fulltext.substring(whichchar,whichchar+1) + </font> +
fulltext.substring(whichchar+1,fulltext.length);
break;
}
if(navigator.appname == "netscape") {
size = "<font point-size=25pt>";  
document.wds.document.write(size+<center> + fulltext + </center></font>);
document.wds.document.close();
}
if (navigator.appversion.indexof("msie") != -1){
wds.innerhtml = <center> + fulltext + </center><p>;
wds.style.fontsize=25px
   }

settimeout("livetext()",speed);
}

livetext()

</script>

</font>

</body>
</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 一个有趣的JS:随机效果文本-定时的从一段文本中随机选择一个字符,改变颜色。可以学习一下JS。-PHP教程,PHP应用
分享到: 更多 (0)