开发者

document.write clear all controls of page

document.write clear all controls of page HI' when the document.write be run, all controls in the web开发者_高级运维 pages will be clear . why? In asp file


Use innerHTML of say a div to write.

<div id="iwanttowritemore"></div>

Then in JS:

document.getElementById("iwanttowritemore").innerHTML = "i can write without clearing the page"


You can't use document.write after the page has loaded, it'll replace the entire page with the contents of said function. Use something else like innerHTML if you need to insert content after the page loads. document.write is kinda frowned upon anyways.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜