Home  >  Article  >  Database  >  Detailed instructions for using JavaScript alert() function

Detailed instructions for using JavaScript alert() function

高洛峰
高洛峰Original
2016-12-20 11:44:542040browse

 Here is a brief introduction to the use of the JavaScript alert() function. alert-pops up a message dialog box, and the alert message dialog box is usually used to provide some prompt information to the user.

 JavaScript alert() function

 alert--pop-up message dialog box (there is an OK button in the dialog box)

 alert, the meaning of "reminder" in Chinese

 alert function syntax

 alert(str);

 alert Illustration of function prompt box

JavaScript alert()函数详细使用说明

alert function parameters

str--the text to be displayed in the message dialog box

When incorrect data is entered into the 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 exclusive, that is, no other operations can be performed before the user clicks the button in the dialog box.

 Tips: Message dialog boxes can often be used to debug programs.

  Example

alert("Hellodreamdu!"); alert('Welcometo
dreamdu!'); alert('Welcometondreamdu!');


Pay attention to the second and third above Example, only the third example can achieve line wrapping. Refer to the ASCII code table. Line wrapping cannot be achieved using the br tag in HTML.



For more detailed instructions for using the JavaScript alert() function, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn