最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Javascript miscellanea -display data real time, using window.status

 更新時(shí)間:2007年01月09日 00:00:00   作者:  
<script type="text/javascript">
 //<![CDATA[
 function fstatus() {
 for (var i=0; i<100000; i++) {
 window.status = "now process is \"" +i+ "\"";
 }
 }
 function finnerHtml() {
 for (var i=0; i<1000; i++) {
 document.getElementById("demo").innerHTML = "now process is \"" +i+ "\"";
 }
 }
 //]]>
 </script>
<input type="button" onclick="fstatus()" value="test status"/>
<input type="button" onclick="finnerHtml()" value="test innerHTML"/>
<div id="demo"></div>
In the above example,one have a loop and display it real time use innerHTML property, another is use window.status.

However, the window.status in real time that perfect display the loop digit, but the innerHTML property is not.
Just display result digit: now process is "999".

And how to using innerHTML display real time data? can but use window.setTimeout, or window.setInterval method, like this:

 var cnt=0;
 function finnerHtml() {
 if (cnt++>=1000) return;
 document.getElementById("demo").innerText = "now process is \"" +cnt+ "\"";
 window.setTimeout(finnerHtml,10)
 }

But, it's no convenient. the display speed is not well, and we must control something.
e.g.
setTimeout variables, when it completely.

So, I propose winodw.status to replace innerHTML property when display in real time. 

相關(guān)文章

最新評(píng)論

余庆县| 布尔津县| 孝昌县| 宝鸡市| 台北市| 峡江县| 大同县| 正宁县| 邢台市| 花垣县| 怀远县| 屯门区| 将乐县| 元谋县| 扬州市| 灵寿县| 莱西市| 白银市| 古蔺县| 北碚区| 崇阳县| 綦江县| 佛坪县| 永宁县| 大竹县| 灵台县| 南京市| 进贤县| 荣昌县| 邛崃市| 永德县| 陵川县| 陈巴尔虎旗| 宜川县| 穆棱市| 平陆县| 黄骅市| 大埔区| 彭州市| 新野县| 岳阳市|