JavaScript alert () function usage instructions

Source: Internet
Author: User

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

 
 
  1. Alert ("Hellodreamdu! ");
  2. Alert ('welcometo <br/> dreamdu! ');
  3. 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.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.