发光字

2015-02-16 17:23:51 -0500
«Newer      Older»

----Comments(1)----
@yy321 | @ at 2015-02-16 17:24:
<body>
<div id="whole_body">
<div class="wo-entry-section"><BODY onLoad="loadText()">
<Script language="JavaScript">
var someText = "因缘分而相识;因情分而相守。温馨的日子如你我初见时那样甜蜜;美满的生活如爱情初见时那样浪漫!"; // 闪烁文本
var aChar;
var aSentence;
var i=0; // a counter
var colors = new Array("FF0000","FFFF66","FF3399","00FFFF","FF9900","00FF00"); // the colors
var aColor; // the chosen color
function loadText()
{
// randomly choose color
aColor = colors[Math.floor(Math.random()*colors.length)];
aChar = someText.charAt(i);
if (i == 0)
aSentence = aChar;
else
aSentence += aChar;
// 50 iterations max.
if (i < 50) i++;

// For IE
if (document.all)
{
textDiv.innerHTML= "<font color='#"+aColor+"' face='Tahoma' size='5'><i>"+aSentence+"</i></font>";
setTimeout("loadText()",100);
}

// For Netscape Navigator 4
else if (document.layers)
{
document.textDiv.document.write("<font color='#"+aColor+"' face='Tahoma' size='5'><i>"+aSentence+"</i></font>");
document.textDiv.document.close();
setTimeout("loadText()",100);
}

// For other
else if (document.getElementById)
{
document.getElementById("textDiv").innerHTML = "<font color='#"+aColor+"' face='Tahoma'size='5'><i>"+aSentence+"</i></font>";
setTimeout("loadText()",100);
}
}
</SCRIPT>
<div id="textDiv"></div>
</body>
</html>
Comment:
Name:

Back to home

Subscribe | Register | Login | N