Wednesday, 18 April 2012

How to show alert box in javascript?

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

Syntax:
alert(your message)

you can give any appropriate message.

Example:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
      <title>Alert Box Example</title>
        <script type="text/javascript" language="javascript">
             function show()
            {
                alert("Hello World!");
            }
        </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        <input type="button" id="alertshow" name="alertshow"         onclick="show();" value="Alert Box" />
    </div>
    </form>
</body>
</html>

Output:


No comments:

Post a Comment