<div class="codetitle"> <span><a style="CURSOR: pointer" data="93346" class="copybut" id="copybut93346" onclick="doCopy('code93346')"><u>复制代</u></a></span>代码如下:</div> <div class="codebody" id="code93346"> <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><title>appendChild,innerHTML,join</title> <br><script type="text/javascript"><!-- <BR>//appendChild() メソッド追加span标签 <BR>function AppendDiv() <BR>{ <BR>var time= parseInt(document.getElementById('tbTimes').value); <BR>var oDiv=document.getElementById('div1'); <BR>var Text=document.getElementById('tbText').value; <BR>var Time=new Date(); <BR>var StartTime=Time.getTime(); <BR>for(var i=1;i<times;i ) <BR>{ <BR>var span=document.createElement('span'); <BR>span.appendChild(document.createTextNode(Text)); <BR>oDiv.appendChild(スパン); <BR>} <BR>var Time1=new Date(); <BR>var EndTime=Time1.getTime(); <BR>document.getElementById('TbDate').value=EndTime-StartTime <BR>} <BR>//innerhtml() メソッド追加span标签 <BR>function InnerHTML() <BR>{ <BR>var time =parseInt(document.getElementById('tbTimes').value); <BR>var oDiv=document.getElementById('div1'); <BR>var Text=document.getElementById('tbText').value; <BR>var Time=new Date(); <BR>var StartTime=Time.getTime(); <BR>for(var i=1;i<times;i ) <BR>{ <BR>oDiv.innerHTML ="<span>"テキスト「</span>」; <br>} <br>var Time1=new Date(); <br>var EndTime=Time1.getTime(); <br>document.getElementById('TbDate').value=EndTime-StartTime <br>} <br>//配列中プッシュ追加スパンを使用 <br>function Join() <br>{ <br>var time=parseInt (document.getElementById('tbTimes').value); <br>var oDiv=document.getElementById('div1'); <br>var Text=document.getElementById('tbText').value; <br>var Time=new Date(); <br>var StartTime=Time.getTime(); <br>var MyArray=new Array(); <br>for(var i=1;i<times>{ <br>MyArray.push("<span>" Text "</span>"); <br>} <br>oDiv.innerHTML=MyArray.join(' '); <br>var Time1=new Date(); <br>var EndTime=Time1.getTime(); <br>document.getElementById('TbDate').value=EndTime-StartTime <br>} <br><br>// --></script> <br></head> <br> <br><input type="text" id="tbText" value="ws_hgo " /><br /> <br><input type="text" id="tbTimes" value="1000" /><br /> <br><input type="text" id="TbDate" /><br /> <br><input id="Button1" type="button" value="追加" onclick="AppendDiv();" /> <BR><input id="Button2" type="button" value="innerHTML" onclick="InnerHTML();" /> <BR><input id="Button3" type="button" value="参加" onclick="参加();" /> <BR><div id="div1"> <br></times> </div> <br></body> <br></html><br>