Here we will briefly introduce how to use the JavaScript alert () function. The alert -- pop-up message dialog box, And the alert message dialog box is usually used for user prompt information.
JavaScript alert () function
Alert -- an OK button in the pop-up message dialog box)
Alert, meaning of "Reminder" in Chinese
Alert function syntax
Alert (str );
Alert function prompt box
Alert function parameters
Str -- text to be displayed in the message dialog box
Alert Function Description
The alert message dialog box is usually used for user prompts, for example, when incorrect data is entered in a form.
Tip: the message dialog box is provided by the system, so the style font may be different in different browsers.
Tip: the message dialog box is arranged, that is, you cannot perform any other operations before clicking the button in the dialog box.
Tip: message dialog boxes can be used to debug programs.
Example
- Alert ("Hellodreamdu! ");
- Alert ('welcometo <br/> dreamdu! ');
- Alert ('welcometo \ ndreamdu! ');
Note that in the second and third examples above, only the third example can implement line breaks. Refer to the ASCII code table and use the br label in HTML to avoid line breaks.