颜色变幻的欢迎词

立即领取

最高 ¥2000 红包 限量领取

云服务器、主机等产品通用,可叠加官网常规优惠使用 | 限时领取

逐字打印后文字消失,然后整体出现,整个过程随机颜色效果。

<!doctype html>
<html>
<head>
<title>颜色变幻的欢迎词</title>
<body onLoad=”loadText()”>
<Script language=”JavaScript”>
var someText = “美肤堂欢迎您,请多多指教!”;
var aChar;
var aSentence;
var i=0;
var colors = new Array(“FF0000″,”FFFF66″,”FF3399″,”00FFFF”,”FF9900″,”00FF00″);
var aColor;

function loadText()
{
aColor = colors[Math.floor(Math.random()*colors.length)];
aChar = someText.charAt(i);
if (i == 0)
aSentence = aChar;
else {
aSentence=””;
for (j=0;j<=i;j++){
aSentence+=”&nbsp;&nbsp;”
}
aSentence += aChar;
}
if (i < 50) i++;
if(i<someText.length){
if (document.all)
{
textDiv.innerHTML= “<font color=’#”+aColor+”‘ face=’Tahoma’ size=’7′><i>”+aSentence+”</i>”;
setTimeout(“loadText()”,500);
}
else if (document.layers)
{
document.textDiv.document.write(“<font color=’#”+aColor+”‘ face=’Tahoma’ size=’5′><i>”+aSentence+”</i>”);
document.textDiv.document.close();
setTimeout(“loadText()”,500);
}
else
if (document.getElementById)
{
document.getElementById(“textDiv”).innerHTML = “<font color=’#”+aColor+”‘face=’Tahoma’size=’5’><i>”+aSentence+”</i>”;
setTimeout(“loadText()”,500);
}
}
else {
if (document.all)
{
textDiv.innerHTML= “<font color=’#”+aColor+”‘ face=’Tahoma’ size=’7′><i>”+someText+”</i>”;
setTimeout(“loadText()”,500);
}
else if (document.layers)
{
document.textDiv.document.write(“<font color=’#”+aColor+”‘ face=’Tahoma’size=’5’><i>”+someText+”</i>”);
document.textDiv.document.close();
setTimeout(“loadText()”,500);
}
else if (document.getElementById)
{
document.getElementById(“textDiv”).innerHTML = “<font color=’#”+aColor+”‘face=’Tahoma’size=’5’><i>”+someText+”</i>”;
setTimeout(“loadText()”,500);
}
}

}
</SCRIPT>
<div id=”textDiv”></div>
</body>

未经允许不得转载:王刚博客 » 颜色变幻的欢迎词

赞 (1) 打赏

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏