Home > Article > Web Front-end > How to use alert in js
JavaScript alert() function is a pop-up window function. The user can specify a text string or a value to be converted to a string as a parameter, which is displayed in the prompt window and used to display a brief notification.
Usage of alert() function in JavaScript
What is alert() function? The
alert() function is a JavaScript function that pops up a window in the user interface to display a specified message.
Syntax:
<code>alert(message);</code>
Parameters:
How to use alert() function?
To use the alert() function, simply call it in your JavaScript code, specifying the message you want to display in the alert window. For example:
<code>alert("欢迎访问我的网站!");</code>
This will pop up a window in the user interface with the message "Welcome to my website!".
Example:
Use the alert() function to pop up a window with the text "Submission successful":
<code>alert("提交成功!");</code>
Use the alert() function to pop up Window with the number "123":
<code>alert(123);</code>
Tip:
The above is the detailed content of How to use alert in js. For more information, please follow other related articles on the PHP Chinese website!