JavaScript: Inserting Text Into the Body of a Page
Javascript is event driven. It does something in response to a user-action–mouse movements, keyboard, etc.
JavaScript functions can be placed in the head of a Web page (or called from a separate .js file listed in the head) and called by an event handler placed in the body of the document.
To create a function that places text on a Web page, enter this function in the head section:
<script> function place() { var msg = ""; document.open(); document.write(msg); document.close(); } </script>And then augment the body tag so it calls the place function thusly:
<body onload="place()">