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

2016-02-19 10:56 3 1 收藏

下面图老师小编要向大家介绍下Javascript miscellanea -display data real time, using window.status,看起来复杂实则是简单的,掌握好技巧就OK,喜欢就赶紧收藏起来吧!

【 tulaoshi.com - Web开发 】

script type="text/javascript"
 //![CDATA[
 function fstatus() {
 for (var i=0; i100000; i++) {
 window.status = "now process is "" +i+ """;
 }
 }
 function finnerHtml() {
 for (var i=0; i1000; 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. 

来源:https://www.tulaoshi.com/n/20160219/1596129.html

延伸阅读
标签: Web开发
Most users will only want to use the innerText/innerHTML and outerText/outerHTML properties and methods discussed previously. However, there is some more advanced text manipulation that can ...
状态条用于显示一些提示字符。MFC中使用CStatusBar类来封装状态条控件的各种操作。通过调用 BOOL Create( CWnd* pParentWnd, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, UINT nID = AFX_IDW_STATUS_BAR );创建一个窗口,dwStyle中可以使用以下一些状态条控件的专用风格: CBRS_TOP Dialog Bar在父窗口的顶部 状态条在父窗口的顶...
标签: 电脑入门
Time is we do not come loose.
标签: Web开发
系统中用javascript中的window.open后,页面返回了一个[object]。因为系统的原因,必需使用href="javascript:window.open()"这样的格式。所以只能通过以下办法解决。 解决window.open后返回object的错误 a href="javascript:void(window.open('','','width=200,height=200'))"window.open()/a 顺便在这里将window.o...
标签: ASP
Status Status 属性指定服务器返回的状态行的值。HTTP 规格中定义了 Status 值。 语法 Response.Status = StatusDescription 参数 StatusDescription 包含表示状态码的三位数和该代码简短说明的字符串。例如,310 Move Permanently。 注释 使用该属性修改服务器返回的状态行。 示例 下面示例设置响应状态。 <% Response.Sta...

经验教程

577

收藏

97

精华推荐

建立Floating Window(Top Most的window)

建立Floating Window(Top Most的window)

229085450

General Window

General Window

小菲翩翩

Display SQL Server Version Information

Display SQL Server Version Information

Hi搞大象嗎

微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部