Javascript allows us to write to an html page using the document.write() method
Place the code below between body tags in an html page
<script type='text/javascript'>
document.write("This is <b>javascript</b> generated html");
</script>
Note how we can add html tags if we wish.
(Be aware document.write is an old fashioned technique.
We will look at
another and better way of using javascript to write html later.)
Exercise Try changing the bold tags to italic tags and refresh the page.
Of course this is just the same as writing plain html
So why bother?
We can get some interesting effects if we combine document.write with other javascript code such as the window.prompt() method.