<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>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다 </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>