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
 
Back
Top