O'Reilly logo

JavaScript by Example, Second Edition by Ellie Quigley

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

Chapter 4. Dialog Boxes

image

4.1 Interacting with the User

Programs like to talk, ask questions, get answers, and respond. In the previous chapter, we saw how the write() and writeln() methods are used to send the document’s output to the browser. The document is defined in an object and write() and writeln() are methods that manipulate the document, make it do something. The document object is defined within a window. The window is also an object and has its own methods.

The window object uses dialog boxes to interact with the user. The dialog boxes are created with three methods:

alert()

prompt()

confirm()

4.1.1 The alert() Method

The window’s ...

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