添加确认框
这是我的代码,我想向其中添加一个确认框。
我有一个带有两个提交
按钮的表单。我需要他们的确认框,然后发送到下一页。我怎样才能做到这一点?
这是确认框的代码,我如何将其放入我的表单中?
onclick="return confirm('Are you sure?');"
myform.jsp
<form id="form1" name="form1" method="post" action="">
<p> </p>
<p align="center">Enter your choice:-
<label> <br />
<label>
<input type="submit" name="Submit" value="delete" onclick="this.form.action='logi.jsp?flag=1&act=1';this.form.submit();" />
</label>
<br />
</br>
<label>
<input type="submit" name="Submit" value="Delete" onclick="this.form.action='delete1.jsp?flag=1&act=1';this.form.submit();" />
</label>
<br/>
</div>
</form>
最佳答案
在按钮类上尝试这个
$('.class').appendTo('body')
.html('<div><h6>Yes or No?</h6></div>')
.dialog({
modal: true, title: 'message', zIndex: 10000, autoOpen: true,
width: 'auto', resizable: false,
buttons: {
Yes: function () {
doFunctionForYes();
$(this).dialog("close");
},
No: function () {
doFunctionForNo();
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
关于javascript - 如何在提交按钮之前添加确认框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14211792/