please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Window.alert() Method

Name

Window.alert() Method---display a message in a dialog box

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

window.alert(message)

Arguments

message

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

Returns

nothing.

Description

The alert() method displays the specified message to the user in a dialog box. The dialog box contains an OK button that the user can click to dismiss the dialog box.

The dialog box that is displayed is non-modal. That is, the user can continue to interact with the browser window while the dialog is displayed. JavaScript execution continues while the dialog is displayed; it does not pause until the user dismisses the dialog.

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 can inform the user of the problem and explain what needs to be corrected to avoid the problem in the future. The appearance of the alert() dialog box is platform-dependent, but generally it contains graphics that indicate that the message indicates an error, a warning, or an alert of some kind. While alert() can display any desired message, the "alert" graphics of the dialog mean that this method is not appropriate for simple informational messages like "Welcome to my home page" or "You are the 177th visitor this week!"

Note that the message displayed in the dialog is a string of plain text, not formatted HTML. You can use the newline character, \n, in your strings to break your message across multiple lines. You can also do some very rudimentary formatting using spaces and can approximate horizontal rules with underscore characters, but the results you achieve will depend greatly on the font used in the dialog, and will thus be system dependent.

In Netscape Navigator, the message displayed is prefaced with "JavaScript Alert:". The alert box in Microsoft Internet Explorer does not display any similar indication that the message comes from a JavaScript program; this has been raised as a possible security concern.

See Also

"Window", "Window.confirm()", "Window.prompt()"


Previous Home Next
Window Book Index Window.blur()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/JAVA/SCRIPT/definitive/refp_429.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/12/23 08:39,
TOP NEW HELP FIND: 
18.219.81.129:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/techref/language/JAVA/SCRIPT/definitive/refp_429.htm"> [Chapter 21] Reference: Window.alert()</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .