Friday, August 16, 2013

JavaScript confirm box

<html>
<head>
<script type="text/javascript">
function show_confirm()
{
var r=confirm("Press a button");
if (r==true)
  {
  document.write("You pressed OK!");
  }
else
  {
  document.write("You pressed Cancel!");
  }
}
</script>
</head>
<body>

<input type="button" onClick="show_confirm()" value="Show a confirm box" />

</body>
</html>

Result


No comments: