最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I clear the screen with javascript? - Stack Overflow

programmeradmin4浏览0评论

How can I clear or refresh the page in the browser using javascript? I have a loop that prints a string to the page each second and I want to clear the screen each time it updates.

How can I clear or refresh the page in the browser using javascript? I have a loop that prints a string to the page each second and I want to clear the screen each time it updates.

Share Improve this question edited Mar 5, 2014 at 7:51 iKlsR asked Apr 1, 2012 at 19:23 iKlsRiKlsR 2,6726 gold badges29 silver badges46 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 11

If you append your string to the document body, you can just use

document.body.innerHTML = "";

You may choose to write it like this

 document.write(‘ ‘)
发布评论

评论列表(0)

  1. 暂无评论