Display an alert box:
alert("Hello! I am an alert box!!");
Try it Yourself »
More examples below.
The alert()
method displays an alert box with a message and an OK button.
The alert()
method is used when you want information to come through to the user.
The alert box takes the focus away from the current window, and forces the user to read the message.
Do not overuse this method. It prevents the user from accessing other parts of the page until the alert box is closed.
alert(
message)
Parameter | Description |
message | Optional. The text to display in the alert box. |
NONE |
alert()
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!