用js提交表单解决一个页面有多个提交按钮的问题

(编辑:jimmy 日期: 2026/1/19 浏览:2)

用js提交表单解决一个页面有多个提交按钮的问题,主要是判断是否为提交文本,然后再执行相应的动作,比较简单。

<pre class="javascript" name="code">function check(txt){ 
$j("form").submit(function(){ 
if($txt=="提交"){ 
this.action="doAddMessage.action"; 
this.submit(); 
}else{ 
this.action="doAddMessage.action"; 
this.submit(); 
} 
}); 
}</pre><br> 
<input type="IMAGE" src="/UploadFiles/2021-04-02/send.png">