Window alert()Method

Window 对象参考手册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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the alert() method


Example

Example

Display an alert box:

<script>
function myFunction(){
alert("Hello, I am an alert box!");
}
</script>

Try it Yourself »


实例

More Examples

Another popup example


Window 对象参考手册Window Object Other Extensions