O'Reilly logo

Platinum Edition Using XHTML™, XML, and Java™ 2 by Andrew H. Watt, Mike Morgan, Jim O'Donnell, Eric Ladd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required