Window alert() Method
Window Object
Definition and Usage
The alert() method displays an alert box with a specified message and an OK button.
Syntax
Browser Support

The alert() method is supported in all major browsers.
Example
Example
Display an alert box:
<html>
<head>
<script>
function display_alert()
{
alert("Hello! I am an alert box!!");
}
</script>
</head>
<body>
<input type="button" onclick="display_alert()"
value="Display alert box">
</body>
</html>
Try it yourself »
More Examples
Alert box with line-breaks
Window Object
Thank You For Helping Us!
Your message has been sent to W3Schools.
Close [X]