Example 4

This example is almost identical to the previous one. All I have done is change this first paragraph and then change the alert() statements into document.write() statements. Compare the source code for this example with that for Example 1.

Now we are back in HTML, not JavaScript. This second part of the web page didn't appear until after you clicked on the OK button in the alert() box. Ready for the next one?

As you can see. You can have several JavaScript programs in the same web page. Time for one more, I think!

Use the Source or View Source option on your View menu to see how it works. Then use the Back icon on the toolbar.