国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

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

2019-11-21 02:21:58
字體:
來源:轉載
供稿:網(wǎng)友
<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. 
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 阿城市| 佛山市| 正蓝旗| 沈阳市| 东兴市| 泸溪县| 延庆县| 舒城县| 罗甸县| 龙泉市| 墨竹工卡县| 潮州市| 白城市| 成都市| 施秉县| 仙桃市| 玉山县| 泰来县| 鹤岗市| 哈密市| 上犹县| 阜阳市| 政和县| 宁远县| 山阳县| 澎湖县| 绍兴县| 邛崃市| 来宾市| 丘北县| 广河县| 云和县| 公主岭市| 台湾省| 靖西县| 锡林浩特市| 莆田市| 丘北县| 萨迦县| 清远市| 永靖县|