一个有趣的JS:随机效果文本-定时的从一段文本中随机选择一个字符,改变颜色。可以学习一下JS。
时间:2007-02-17 来源:PHP爱好者
<!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 [email protected]</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>
php爱好者站 http://www.phpfans.net PHP|MySQL|javascript|ajax|html.
<HTML>
<head>
<SCRIPT LANGUAGE="javascript">
<!--
function open () {return true;}
//-->
</SCRIPT>
<title>Ripple Text Examples by Mark Boyle email [email protected]</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>
php爱好者站 http://www.phpfans.net PHP|MySQL|javascript|ajax|html.
相关阅读 更多 +