加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 如果在同一表单上有多个提交按钮,如何使用onsubmit()显

发布时间:2020-12-14 23:40:07 所属栏目:资源 来源:网络整理
导读:form onsubmit="return confirm('Are you sure you want to rollback deletion of candidate table?')"input type='submit' name='delete' value='Undo' /input type='submit' name='no' value='No' / 当用户点击第二个提交按钮,即不想我将确认对话框显示为
<form onsubmit="return confirm('Are you sure you want to rollback deletion of candidate table?')">
<input type='submit' name='delete' value='Undo' />
<input type='submit' name='no' value='No' />

当用户点击第二个提交按钮,即不想我将确认对话框显示为“您确定要提交交易吗?”

解决方法

<form method='post'>
    <input type='submit' name='undo' value='Undo' onclick="return confirm('Are you sure you want to rollback deletion of candidate table?')"/>
    <input type='submit' name='no' value='No' onclick="return confirm('Are you sure you want to commit delete and go back?')"/>
</form>

工作得很好.刚刚将onsubmit()更改为onclick().因为在这种情况下两者的功能是相同的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读