Window alert() Method - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window alert


The alert() method displays an alert box with a specified message and an OK button.

Parameter Values

Parameter Type Description
message String Optional. text to display in the alert box, or an object

Return Value:

No return value

The following code shows how to Display an alert box:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

function myFunction() {/*  ww  w.  j a va2s .  c o m*/


Related Tutorials