Erhnam |
02-24-2005 08:39 AM |
[javascript] confirm button on php page
I created a php page with a button and some extra functionality:
PHP Code:
echo "------------<br><br>"; echo "<form method='POST' action='function_extract.php'>"; echo "Reinstall: </td><td>"; echo "<select class='dropdown' name='tarball'>"; exec ("cd /control-panel/ | ls $mm3*-server.tar.gz", $tarlijst); foreach ($tarlijst as $inhoud) { echo "<option value='$inhoud'>$inhoud</option>"; } echo "</select>"; echo "<br><br><input type='submit' value='Reinstall' OnClick=\"confirmSubmit()\">"; echo "</form>";
Now I want to add a confirmation window before proceeding the next page (form).
I included this code
Code:
<script LANGUAGE="JavaScript">
<!--
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
return true ;
else
return false ;
}
</script>
But is doesn't seems to work very well.. At least a pop window is displayed but the will always be redirected to the next page. Anyone know exactly how this works?
|