Sponsored Ad

Thursday, April 15, 2010

How to use Confirm Button in JavaScript

 

Sometimes we need to take confirmation before processing certain task. This can be implemented using JavaScript, there is a confirm function in JavaScript which takes message as input and if user accept the confirmation it return true otherwise false. Here is small demonstration of this function. Please let me know incase of any questions.


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

No comments:

Post a Comment

Sponsored Ad

Development Updates