Closed
Bug 280161
Opened 20 years ago
Closed 20 years ago
callback function set by setInterval can override the whole document
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: iamawalrus, Unassigned)
References
()
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041206 Firefox/1.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041206 Firefox/1.0
I have a function which writes to the document with "document.write". When I set
the function with setInterval, the whole document will be replaced by what the
function writes out.
Reproducible: Always
Steps to Reproduce:
load following html in browser:
<HTML>
<HEAD>
</HEAD>
<BODY>
begin</br>
<SCRIPT language=javascript>
function getthedate(){
var mydate=new Date()
document.write(mydate)
}
setInterval("getthedate()",1000)
</SCRIPT></br>
end
</body>
</html>
Actual Results:
Fri Jan 28 2005 14:32:52 GMT+0800 (CST)
Expected Results:
wherever the "Fri Jan 28 2005 14:32:52 GMT+0800 (CST)" is written to, the
"begin" and "end" should not be lost.
Comment 1•20 years ago
|
||
Why do you think that? IE is doing exactly the same.
This is just how document.write works.
Comment 2•20 years ago
|
||
IE does the same thing. Your function is called after the page finishes loading
and the document.write clobbers the page. I would say invalid.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•