Window Methods for Getting User Input

You can use three window object methods to solicit input from your users. You can use JavaScript to create windows and display custom-made forms to get any kind of input from your user that you would like. The three built-in methods, on the other hand, give you quick, easy ways to get input. These methods are

  • alert()

  • confirm()

  • prompt()

Notification Using the Alert Method

Listing 20.6 shows an example of using the window.alert() method. This method is used to notify your user of something, and it can only be responded to by clicking OK. Figure 20.6 shows an example of the alert using this method.

Figure 20.6. Alert boxes are not used for user input so much as to tell the user something and to make sure the ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.