我正在尝试使用 onsubmit="return recognize('Do you确实要提交表单吗?')"
在用户通过单击提交按钮删除项目之前显示警告。我无法出现确认框,它只是继续直接删除该项目。
任何人都可以在我的代码中看到我可能出错的地方吗?我尝试过更改双引号和单引号,但没有任何努力让确认框出现。
我的代码如下。
echo '<td> <form method="post" action="deleteassign.php" name="deleteassignform"
id="deleteassignform" onsubmit="return confirm('Do you really want to submit the form?')">';
echo '<input type="hidden" name="quizidvalue" id="quizidvalue" value="'.$sendquizid.'" />';
echo '<input type="hidden" name="classidvalue" id="classidvalue" value="'.$sendclassid.'" />';
echo '<input type="submit" name="deleteassignment" id="deleteassignment" value="Delete This Assignment"> </form> </td> </tr>';
最佳答案
更改您的:
return confirm('Do you really want to submit the form?')
至
return confirm(\'Do you really want to submit the form?\')
这应该可以解决给您带来的任何 qouting 问题,因为它肯定是错误的 qouting。
关于php - 提交时无法出现确认框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14941225/