Home > Web Front-end > JS Tutorial > Javascript miscellanea -display data real time, using window.status_Typical special effects

Javascript miscellanea -display data real time, using window.status_Typical special effects

WBOY
Release: 2016-05-16 19:21:38
Original
1144 people have browsed it





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.
<script> <BR> //<![CDATA[ <BR> function fstatus() { <BR> for (var i=0; i<100000; i++) { <BR> window.status = "now process is \"" +i+ "\""; <BR> } <BR> } <BR> function finnerHtml() { <BR> for (var i=0; i<1000; i++) { <BR> document.getElementById("demo").innerHTML = "now process is \"" +i+ "\""; <BR> } <BR> } <BR> //]]> <BR> </script>So, I propose winodw.status to replace innerHTML property when display in real time. 
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template