Window alert()Method
Window Object
Definition and Usage
The alert() method is used to display an alert box with a specified message and aconfirmbutton.
Syntax
alert(message)
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the alert() method
Example
Example
Display an alert box:
<script>
function myFunction(){
alert("Hello, I am an alert box!");
}
</script>
function myFunction(){
alert("Hello, I am an alert box!");
}
</script>
Try it Yourself »
More Examples
Window Object Other Extensions