Pages

How to create Alert Box using JAVA SCRIPT

Create Alert Box using Java Script


     Hello readers today i'am going to teach you how to create Alert Box using Java script. before this, if you don't have any basic knowledge about JAVA SCRIPT, Please click HERE.

     Like Previous tutorial, first we need to write our JAVA SCRIPT in Header section.


<head>
<script type= "text/javascript">
function alert()
{
        alert("Hello I am Alert Box");
}
</script>
</head>

     Now we already write our JAVA SCRIPT, in next section i am going to teach you how to add these JAVA SCRIPT to BUTTON. So, do this we need to write this HTML code in HTML BODY,

<html>
<head>
<script type= "text/javascript">
function alert()
{
        alert("Hello I am Alert Box");
}
</script>
</head>

<body>

<input type="button" onclick="alert()" value="I am Alert Box" />

</body>
</html>

     Save this source code as <name>.html and run. see what happen...