<div class="codetitle"> <span><a style="CURSOR: pointer" data="13664" class="copybut" id="copybut13664" onclick="doCopy('code13664')"><u>复主代码</u></a></span> 代码如下:</div> <div class="codebody" id="code13664"> <br><style> <br>BODY {FONT-SIZE: 9pt;} <br>테이블 {FONT-SIZE: 9pt;} <br></style> <br><br><input type=checkbox id=checkall onclick=check_all()><label for=checkall>전체부选择</label> <br>线程数:<input type=text id=the_thread value=10 size=2 maxlength=2 style="height:15px; font-size:12px;padding:0px"> <br><br> <br><표 테두리=0> <br><tr><td style="width:100px;over-flow:hidden"><span id=show></span></td> <br><td style="width:400px;"> <br><table id=bar style="width:90%;height:10px;border:1px black solid;display:none"><tr> <br><td id=bar1 bgcolor=skyblue style="width:0%"></td> <br><td id=bar2 style="width:100%"></td> <br></tr></table> <br></td></tr> <br><tr><td colspan=2><span id=result></span></td></tr> <br></테이블> <br><script 언어="JavaScript"> <br>/* <br>다음 코드는 Windy_sk<seasonx@163.net>에서 디자인하고 작성했습니다. <br> 자유롭게 사용하실 수 있으나, 저작권 항목은 모두 보유하셔야 합니다! <br>*/ <br>var 전체 = 505; <br>var thread_num; <br>var pre_thread; <br>var thread = new Array(); <br>var 완료됨 = = 0; <br>var start_time = null; <br><br>for(i=0;i<total><br>함수 init_para(){ <br>thread_num = parseInt(the_thread.value); <br>if(isNaN(thread_num)) thread_num = 10; <br>pre_thread = Math.floor(total/thread_num); <br>result.innerText = ""; <br>bar1.style.width = "0%"; <br>bar2.style.width = "100%"; <br>bar.style.display = ""; <br>} <br><br>function check_all(){ <br>checkall.disabled = true; <br>init_para(); <br>for(var i=0;i<thread_num;i ){ <BR>thread[i]=[setInterval("thread[" i "][1]<pre_thread?check_unit(" i "*pre_thread thread [" i "][1] ):clearInterval(thread[" i "][0])",1),0]; <BR>} <BR>thread[i]=[setInterval("thread[" i "][1]<total%thread_num?check_unit(" i "*pre_thread thread[" i "][1] ):clearInterval (스레드[" i "][0])",1),0]; <BR>} <br><br>function check_unit(num){ <BR>if(completed==0)start_time=new Date; <BR>cbox[num].checked=checkall.checked; <BR>완료 ; <BR>var cur_rate = Math.round(완료*100/전체); <BR>show.innerText = 완료됨 "/" 전체 " : " 현재 비율 "%"; <BR>bar1.style.width = cur_rate "%"; <BR>bar2.style.width = (100-cur_rate) "%"; <BR>if(완료됨 == 전체){ <BR>완료됨 = 0 <BR>checkall.disabled = false; <BR>result.innerText = "(" total "单元/" thread_num "线程, 总共耗时:" ((새 날짜)-start_time) " ms)"; <BR>} <BR>} <BR></script> <br></total> </div> <br><strong>하측면是运行效果<br></strong><div class="htmlarea"><textarea id="runcode21950"> <style> BODY {FONT-SIZE: 9pt;} table {FONT-SIZE: 9pt;} </style> <input type="checkbox" id="checkall" onclick="check_all()"><label for="checkall">전체부选择</label> 线程数:<input type="text" id="the_thread" value="10" size="2" maxlength="2" style="height:15px; font-size:12px;padding:0px"> <table border="0"> <tr> <td style="width:100px;over-flow:hidden"><span id="show"></span></td> <td style="width:400px;"> <table id="bar" style="width:90%;height:10px;border:1px black solid;display:none"><tr> <td id="bar1" bgcolor="skyblue" style="width:0%"></td> <td id="bar2" style="width:100%"></td> </tr></table> </td> <td style="width:100px;over-flow:hidden"><span id="show"></span></td> </tr> <td> <table id="bar" style="width:90%;height:10px;border:1px black solid;display:none"><tr> <td id="bar1" bgcolor="skyblue" style="너비:0%"></td> <td colspan="2"> </td> <td id="bar2" style="너비:100%"><span id="result"> </span></td> </tr></table> <script language="JavaScript"> /* This following code are designed and writen by Windy_sk <seasonx@163.net> You can use it freely, but u must held all the copyright items! */ var total = 505; var thread_num; var pre_thread; var thread = new Array(); var completed = 0; var start_time = null; for(i=0;i<total;i++)document.write("<input type=checkbox id=cbox>"); function init_para(){ thread_num = parseInt(the_thread.value); if(isNaN(thread_num)) thread_num = 10; pre_thread = Math.floor(total/thread_num); result.innerText = ""; bar1.style.width = "0%"; bar2.style.width = "100%"; bar.style.display = ""; } function check_all(){ checkall.disabled = true; init_para(); for(var i=0;i<thread_num;i++){ thread[i]=[setInterval("thread["+i+"][1]<pre_thread?check_unit("+i+"*pre_thread + thread["+i+"][1]++):clearInterval(thread["+i+"][0])",1),0]; } thread[i]=[setInterval("thread["+i+"][1]<total%thread_num?check_unit("+i+"*pre_thread + thread["+i+"][1]++):clearInterval(thread["+i+"][0])",1),0]; } function check_unit(num){ if(completed==0)start_time=new Date; cbox[num].checked=checkall.checked; completed++; var cur_rate = Math.round(completed*100/total); show.innerText = completed + "/" + total + " : " + cur_rate + "%"; bar1.style.width = cur_rate + "%"; bar2.style.width = (100-cur_rate) + "%"; if(completed == total){ completed = 0 checkall.disabled = false; result.innerText = "("+total+"单元/"+thread_num+"线程,总共耗时:"+((new Date)-start_time)+" ms)"; } } </script> <br><input onclick="runEx('runcode21950')" type="button" value="运行代码"><input onclick="doCopy('runcode21950')" type="button" value="复制代码"> <input onclick="doSave(runcode21950)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 모두 선택 참고: </a>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다 ]<script language="JavaScript"> /* This following code are designed and writen by Windy_sk <seasonx@163.net> You can use it freely, but u must held all the copyright items! */ var total = 505; var thread_num; var pre_thread; var thread = new Array(); var completed = 0; var start_time = null; for(i=0;i<total;i++)document.write("<input type=checkbox id=cbox>"); function init_para(){ thread_num = parseInt(the_thread.value); if(isNaN(thread_num)) thread_num = 10; pre_thread = Math.floor(total/thread_num); result.innerText = ""; bar1.style.width = "0%"; bar2.style.width = "100%"; bar.style.display = ""; } function check_all(){ checkall.disabled = true; init_para(); for(var i=0;i<thread_num;i++){ thread[i]=[setInterval("thread["+i+"][1]<pre_thread?check_unit("+i+"*pre_thread + thread["+i+"][1]++):clearInterval(thread["+i+"][0])",1),0]; } thread[i]=[setInterval("thread["+i+"][1]<total%thread_num?check_unit("+i+"*pre_thread + thread["+i+"][1]++):clearInterval(thread["+i+"][0])",1),0]; } function check_unit(num){ if(completed==0)start_time=new Date; cbox[num].checked=checkall.checked; completed++; var cur_rate = Math.round(completed*100/total); show.innerText = completed + "/" + total + " : " + cur_rate + "%"; bar1.style.width = cur_rate + "%"; bar2.style.width = (100-cur_rate) + "%"; if(completed == total){ completed = 0 checkall.disabled = false; result.innerText = "("+total+"单元/"+thread_num+"线程,总共耗时:"+((new Date)-start_time)+" ms)"; } } </script> </td> </table></textarea></div>