form里两个submit按钮,在onsubmit中判断哪个被点
1个回答
展开全部
记下别人的解决方法(有效):
方法1:(已验证过)
<form name="form1" on
submit="show()"
<input type="submit" name="submit" id="submit" value="添加"
<input type="submit" name="submit" id="submit" value="修改"</form
<script language="javascript"function show(){if (document.form1.submit.value=="添加"){alert("你点的是提交");}else{alert("你点的是修改");}}</script
方法二:未验证
<input type=hidden name=whatButton
<input type=submit on
lick="whatButton.value=this.value" value="aaa"
<input type=submit on
lick="whatButton.value=this.value" value="bbb"
<input type=submit on
lick="whatButton.value=this.value" value="ccc"
方法三:已验证
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询