Sunday, 18 January 2015

Java Script alert Example


This is a simple tutorial on how to create a Java Script alert.
In Java Script there is a predefined function called alert() we now just invokes that function. Here we create a button and when button is clicked we call the alert() function with a custom text .

Lets see,

Java Script alert Example


Java Script alert Example


PROGRAM :

<!DOCTYPE html>
<html>
<body>
 
    <p>Click the button to display an alert box.</p>
 
    <button onclick="alert('This is a sample alert !');">Click me</button>
 
</body>
</html>


OUTPUT :

Click the button to show an alert box.

No comments:

Post a Comment