<div class="htmlarea"> <textarea id="runcode44846"> <title>文字入力ウェルカムメッセージのように色が変化します</title> <div id="textDiv"> </div> </textarea> <br><input onclick="runEx('runcode44846')" type="button" value="运行代码"><input onclick="doCopy('runcode44846')" type="button" value="复制代码"> <input onclick="doSave(runcode44846)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A すべて選択 注: </a>外部 Js を導入する必要がある場合は、</div> を実行するために更新する必要があります]<script language="JavaScript"> var someText = "Welcome to Jb51.net"; 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 += aChar; if (i < 50) i++; if (document.all) { textDiv.innerHTML= "<font color='#"+aColor+"' face='Tahoma' size='5'><i>"+aSentence+""; setTimeout("loadText()",100); } else if (document.layers) { document.textDiv.document.write("<font color='#"+aColor+"' face='Tahoma' size='5'><i>"+aSentence+""); document.textDiv.document.close(); setTimeout("loadText()",100); } else if (document.getElementById) { document.getElementById("textDiv").innerHTML = "<font color='#"+aColor+"' face='Tahoma'size='5'><i>"+aSentence+""; setTimeout("loadText()",100); } } </script>