Navigator 2.0, Internet Explorer 3.0
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.
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.
file: /Techref/language/java/SCRIPT/definitive/refp_429.htm, 6KB, , updated: 2019/10/14 16:00, local time: 2024/8/23 11:23,
52.14.24.45: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? <A HREF="http://piclist.com/tecHREF/language/java/SCRIPT/definitive/refp_429.htm"> [Chapter 21] Reference: Window.alert()</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to piclist.com! |
.