我現在這樣的代碼:運行「確定」一個PHP代碼,使用後確認()
<form id="form1" name="form1" method="post" action=""
onclick="return confirm('This is irreversible. Are you sure?');">
<input type="hidden" name="act" value="run">
<input id="btnDelete" name="btnDelete" type="button" value="Delete Selected"/>
</form>
<?php
if (isset($_POST['act']))
{
echo "<script>alert(\"sup\");</script>";
}
?>
警報是檢查是否當我按下「確定」,它將運行。目前沒有。我在我的智慧結束,特別是因爲我幾乎是一個JavaScript的菜鳥。如果有人能幫助它,將不勝感激!
*旁註:*'id'和'name'在提交按鈕,您的形式是在你的情況是不必要的。 – Raptor