HTML - 表单提交按钮确认对话框 [英] HTML - Form Submit Button Confirmation Dialog
问题描述
这是一般表格代码
<form name="search_form" action="" method="POST">
<input type="text" name="search_text">
<input type="submit" name="search_bt" value="Go">
</form>
有没有办法让确认对话框显示'是'\\'否'或'确认'\'取消'等等...
is there a way could have a confirmation dialog saying 'Yes'\'No' or 'Confirm'\'Cancel' etc...
我想到的一种方式是使用CSS Layer和JavaScript和Php ...有一个php isset(){}
按钮上的chechk,当设置显示带有两个按钮的Div时, onclick = func()
JS功能这些按钮设置了php变量(标志)然后我可以 if(flag){}
继续或跳过一些代码...
One way i figured of dong is is with CSS Layer and JavaScript and Php... that have a php isset(){}
chechk on the button and when set display a Div displayed with two buttons and onclick=func()
JS function of those buttons have a php variable(flag) set and then i can if(flag){}
to continue or skip some code...
这是好用的,加点是我可以有一个很好的主题对话框,但我只是想让我的生活更轻松......
well that is going to work and plus point is that i can have a well themed dialog box but i just wanna make my life easier...
推荐答案
您也可以在表格标签本身中使用一行
You can also do it with one line in the form tag itself
<form action="exampleHandlerPage.php" method="post" onsubmit="return confirm('Are you sure you want to submit?');">
这篇关于HTML - 表单提交按钮确认对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!