欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

Javascript miscellanea -display data real time, using window.status_典型特效

程序员文章站 2022-06-04 13:51:48
...




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.