Recently I have been doing some Jscripting and whenever i do a document.writeln it gets all wierd on me:?:.
look a this code for example:
Function write {
if (document.mytext == null) {
document.writeln("There used to be no text here.");
}
}
if i hooked this up to a onload function, the page would only display what i said to write in, and everything else in the document would dissapear.
What do i do???
Shadow webber
0
Newbie Poster
Recommended Answers
Jump to PostThe various document.write methods are depcrecated, and will no longer work in the newer HTML doctypes.
One thing that many forget to do when using document.write(), is to close the document! Be sure you use a document.close() statement at the appropriate spot.
Jump to PostPlease elaborate on your question... I don't know which part of my response you don't understand.
Jump to Postdocument.close();
Jump to PostThat's the "how", as to "why", you have to let the browser know you are done re-writing the document, so it can render it. If you don't do a "document.close()", you'll get varying, unexpected results from one browser to another.
Jump to PostAfter your final "document.write()" statement, inside your "Write" function.
All 18 Replies
tgreer
189
Made Her Cry
Team Colleague
Shadow webber
0
Newbie Poster
tgreer
189
Made Her Cry
Team Colleague
Shadow webber
0
Newbie Poster
Comatose
290
Taboo Programmer
Team Colleague
tgreer
189
Made Her Cry
Team Colleague
Shadow webber
0
Newbie Poster
tgreer
189
Made Her Cry
Team Colleague
Shadow webber
0
Newbie Poster
Comatose
290
Taboo Programmer
Team Colleague
tgreer
189
Made Her Cry
Team Colleague
hari charan
0
Newbie Poster
hollystyles
113
Veteran Poster
hari charan
0
Newbie Poster
hari charan
0
Newbie Poster
hollystyles
113
Veteran Poster
MattEvans
473
Veteran Poster
Team Colleague
Featured Poster
hari charan
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.