Javascript examples for Browser Object Model:Window alert
The alert() method displays an alert box with a specified message and an OK button.
Parameter | Type | Description |
---|---|---|
message | String | Optional. text to display in the alert box, or an object |
No return value
The following code shows how to Display an alert box:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/* ww w. j a va2s . c o m*/ console.log(location.hostname); } </script> </body> </html>