NavBar

Monday 22 January 2018

create alert box | confirm box | prompt box in javascript


popup boxes in javascript | confirm box | alert box | prompt box


In the above image have three popup boxes that is alert box,confirm box and prompt box. these boxes are developed in javascript. mostly these boxes are used for displaying error messages,popup messages and also for displaying advertisement. below we are providing code.there is  javascript function and other method.


popupbox.java

<html>
<head>
<style type="text/css">
#box
{
padding-top:200px;
padding-left:450px;
}
</style>

<script type="text/javascript">
function show_alert()
{
alert("I Am Alert Box");
}
function show_confirm()
{
var r=confirm("Press A Button");
if(r==true)
{
alert("You Press Ok");
}
else
{
alert("You Press Cancel");
}
}
function show_prompt()
{
var name=prompt("Please Enter Your name");
alert("WELCOME " +name);
}

</script>
<body bgcolor="#ffa64d">
<div id="box">
<input type="button" onclick="show_alert()" value="Alert Box" style="height:50px;width:90px;"/>
<input type="button" onclick="show_confirm()" value="Confirm Box" style="height:50px;width:90px;"/>
<input type="button" onclick="show_prompt()" value="Prompt Box" style="height:50px;width:90px;"/>

</div>
</body>
</head>

</html>

No comments:

Post a Comment