Javascript document.write() problem

  • Thread starter Thread starter Robert
  • Start date Start date
R

Robert

I want to use Javascript to add lines of text to an existing page. It seems,
however, that document.write() clears the page before writing to it. Is it
possible to write to a page without first clearing it? I want to add text
immediately below all else on the page.

Any help would be greatly appreciated.

Thanks, Robert
 
Robert said:
I want to use Javascript to add lines of text to an existing page. It
seems, however, that document.write() clears the page before writing
to it. Is it possible to write to a page without first clearing it? I
want to add text immediately below all else on the page.

Any help would be greatly appreciated.

Thanks, Robert

At the bottom of the page, add
<div id="moretext"></div>

In the JS, add
document.getElementById("moretext").innerHTML = "the text you want to be
added"
 
Trevor L. said:
At the bottom of the page, add
<div id="moretext"></div>

In the JS, add
document.getElementById("moretext").innerHTML = "the text you want to be
added"

That works! Thanks, Trevor.

Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top