dai-kun
09-29-2009, 04:52 AM
All I want to do is, 1. Have a button. 2. When clicked on it, it will popup a confirmation box with statement "Are you Sure?" and there will be Yes and No choices to click on. If yes, it runs the script. If no, it will not do anything like they never clicked on it.
I tried doing it but keeps failing:
<form method="POST" action="?do=whatever">
<input type="button" onsubmit="if (confirm('Are you Sure?')) submit();" value="Submit">
</form>
I also tried:
<form method="POST"
action="?do=whatever>"
id="submitform" name="submitform">
<input type="Submit" name="Delete" value="Submit"
onClick="return confirmSubmit()">
</form>
and also added the JS script:
<script LANGUAGE="JavaScript">
function confirmSubmit()
{
var agree=confirm("Are you Sure?");
if (agree)
return true ;
else
return false ;
}
</script>
To my php file, still doesn't do anything when I click it.
I tried doing it but keeps failing:
<form method="POST" action="?do=whatever">
<input type="button" onsubmit="if (confirm('Are you Sure?')) submit();" value="Submit">
</form>
I also tried:
<form method="POST"
action="?do=whatever>"
id="submitform" name="submitform">
<input type="Submit" name="Delete" value="Submit"
onClick="return confirmSubmit()">
</form>
and also added the JS script:
<script LANGUAGE="JavaScript">
function confirmSubmit()
{
var agree=confirm("Are you Sure?");
if (agree)
return true ;
else
return false ;
}
</script>
To my php file, still doesn't do anything when I click it.