Click to See Complete Forum and Search --> : writeln
some14all
11-05-2003, 04:48 PM
is there a way for one not to overwrite the content of the body of an html site when using the document.writeln in javascript.
so basically, i want to append to the page's body instead of overwriting it when i place the document.write in the head section.
Khalid Ali
11-05-2003, 04:54 PM
if you rdocument.writeln() call is executed once the page is loaded,it will override the existing contentsif you logically make sure that it executes beore the apge loads then it will do wha tyou are trying to.
AdamBrill
11-05-2003, 04:57 PM
Also, here is an example of adding content after the page has loaded:<html>
<head>
<title>Changing content of a div</title>
<script type="text/javascript">
function add(){
document.getElementById("add_content").innerHTML += "This is another line...<br>";
}
</script>
</head>
<body>
<input type="button" onclick="add();" value="Add a line!">
<div id="add_content"></div>
</body>
</html>