Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

25. Client-Side JavaScript Reference > Window.alert( ): display a message in a ...

Name

Window.alert( ): display a message in a dialog box — JavaScript 1.0:

Synopsis

window.alert(message)

Arguments

message

The plain-text (not HTML) string to display in a dialog box popped up over window.

Description

The alert( ) method displays the specified message to the user in a dialog box. The dialog box contains an OK button the user can click to dismiss it. The dialog box is typically modal, and the call to alert( ) typically blocks until the dialog is dismissed.

Usage

Perhaps the most common use of the alert( ) method is to display error messages when the user’s input to some form element is invalid in some way. The alert dialog box can inform the user of the problem and explain what needs to be corrected to avoid the problem in the future.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint