<div class="codetitle"> <span><a style="CURSOR: pointer" data="31705" class="copybut" id="copybut31705" onclick="doCopy('code31705')"><u>复制代</u></a></span> 代码如下:</div> <div class="codebody" id="code31705"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml"> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <br><title>無标题文档</title> <br><script type="text/javascript"> <br>function util(){ <br>var elm=function(){ <br>return document.getElementById("testdiv"); <br>} <br>var createtxt=function(){ <br>var textnode=document.createTextNode("测试!"); <br>var divnode=document.createElement("div"); <br>divnode.appendChild(textnode); <br>divnode を返します。 <br>} <br><br>this.process=function(){ <br>elm().appendChild(createtxt()); <br>} <br>} <br><br>var c=new util(); <br>setInterval("c.process()",2000); <br></script> <br><br></head> <br><br> <br><div id="testdiv"></div> <br></body> <br></html> <br> </div>