This is the most common way to get input from users, you can of course use this method inside some of the other protection techniques (encryption and frame-direct printing, for instance) that you'll learn later.
When this page is loaded, the text at the beginning, up until
the first opening <script> tag, is displayed immediately. Then the script
executes and prompts the user for a number. At this point, the
document freezes until the user responds. After the user inputs a number
num, the script writes numbers 1 through num to the document. When the
script finishes, the rest of the document is displayed.
This example demonstrates how a Web page can ask for user input while
it is being loaded and then display content that depends on the user's response.
the Web page prompts the user for a password. The user's response can then be
used to decrypt the rest of the document, as you will see in my next essay (and has you have already seen
coming to the "hyper" section).
Note also in the code the
if (isNaN (num)) num = null;line. This function returns true if a value is not a number ("NaN").