To add content to a webpage by JavaScript, you have two choices:
document.write();
append to a div or other element.
document.write will put the text wherever you call it. However, some browsers are sensitive about using document.write, so it might not always work.
window.onload = function() {
document.write("hello");
document.write("Remembertobringanumbrella.");
document.write("this");
}
A better idea is to append your content to a div or other element already on the page:
<html>
<head><title></title></head>
<body>
<div id="myDiv"></div>
<script>
window.onload = function() {
var theElement = document.getElementById("myDiv");
var hello = document.createTextNode("hello");
var remember = document.createTextNode("Remembertobringanumbrella.");
//'this' is a reserved word in JavaScript
//and cannot be used as a variable name
var final = document.createTextNode("this");
theElement.appendChild(hello);
theElement.appendChild(remember);
theElement.appendChild(final);
}
</script>
</body>
</html>