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!');
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 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!