Home > Web Front-end > JS Tutorial > body text

Instructions for using alert() in JavaScript

黄舟
Release: 2017-11-20 10:04:07
Original
10542 people have browsed it

I believe everyone is familiar with alert() in JavaScript. The alert message dialog box is usually used to provide some prompt information to the user, such as when incorrect data is entered in the form. This article will introduce you to the instructions for using alert() in JavaScript. 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 a message dialog box (there is an OK button in the dialog box)
alert, The meaning of "remind" in Chinese

alert function syntax

alert(str);

alert function prompt box icon

alertFunction parameters

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

alert function description

The alert message dialog box is usually used to provide some prompt information to the user, such as when incorrect data is entered in 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.

Tip: The message dialog box can usually be used to debug the program.

Example

alert("Hellodreamdu!");  
alert('Welcometo<br/>dreamdu!');  
alert('Welcometo\ndreamdu!');
Copy after login

Pay attention to the second and third examples above. Only the third example can achieve line breaks. Refer to the ASCII code table and use the The br tag cannot wrap.

Summary:

This article introduces the usage instructions of alert() in JavaScript in detail. I believe that you will read this article through Through the study, I have a better understanding of the use of alert(). I hope it will be helpful to your work!

Related recommendations:

The alert() function in JavaScript pops up, testing techniques, and detailed explanations on how to issue alerts

The difference between alert() and console.log() in javascript

##alert( ), confirm() and prompt()The difference and usage

The above is the detailed content of Instructions for using alert() in JavaScript. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!