<div class="codetitle"> <span><a style="CURSOR: pointer" data="72668" class="copybut" id="copybut72668" onclick="doCopy('code72668')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code72668"> <br> ="text" style="font-size:20px;">你好,這是一段改變文字大小和顏色的javascript程式碼</div> <br><script type="text/javascript"> <BR>var size = 20; <BR>var falg = 1; <BR>function colortext() <BR>{ <BR> //取得文字的大小 <BR> ); <BR> document.getElementById("text").style.fontSize = getSize(); <BR> } <BR>//設定文字mycolor = "#"; <BR> var color ="123456789abcdef"; <BR> var colorcode = color.split(""); <> var colorcode = color.split(""); <> 🎜> mycolor =colorcode[Math.floor(15*Math.random())]; <BR> 🎜>function getSize() <BR>{ <BR> if(falg == 1) <BR> { <BR> falg = 0; <BR> return size; <BR> } <BR> if(falg == 0) <BR> { <BR> size = size-1; falg = 1; <BR> return size; <BR> } <BR>} <BR>setInterval("colortext()",200); <BR></script> <br> <br><br>