Home Apache PHP Ubuntu MySQL Linux HTML Win CSS Perl Javascript Rants Retro
 
Print This Page
Date Posted: Tuesday 02nd of February 2010 | Category: Javascript
Javascript confirmation button
When the form is submitted, a Javascript alert box appears asking the user to confirm their choice.

<script type="text/javascript">
<!--
function confirmPost()
{
var agree=confirm("Are you sure you would like to continue?");
if (agree)
return true ;
else
return false ;
}
// -->
</script>

<form method = "post" action = "cleartables.php">
<input type ="submit" value="Clear Tables" onClick="return confirmPost()" />