/    Sign up×
Community /Pin to ProfileBookmark

document.write() problem

I try using the document.write() function in my webpage. I usually do this in the form of input buttons and links that trigger “document.write()”. However, sometimes it inserts the stuff inside document.write() into the page, and other times it erases everything on the page and puts in the text inside document.write() in a new page (in which case the Back history button can be pressed to reverse the effect). I just never know what it will do! ? How do I control when document.write() is triggered, if it writes the text in a new page, or just inserts it to the text already on the page? :rolleyes: Please help

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@Zach_ElfersJan 10.2003 — If you are using the document.write() function in the head section, that might be one of the reasons why it is overwriting the page. I have had this problem too and I am not quite sure how to fix it either. I think if you use two or more document.writes consecutively, it overwrites the page.
×

Success!

Help @MarkE spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...