HTML多表单帖子

时间:2016-08-23 12:18:25

标签: html post html-select multiple-forms

我的页面中有两个表单。

<form name="form1" action="" method="POST" autocomplete="off"> 
            <h3><span>Number : </span>
                <span class="min-width"><select class="form-control" id="num" maxlength="255" name="num_selector" onchange="this.form.submit();" autofocus>
<option value="0001" selected="selected">0001</option>
</select></span>
            </h3>
</form>

<form action="/enter" method="POST" name="form2">
       <input class="btn btn-default btn-orange has-spinner" type="submit" value="enter" name="enter">
</form>

当我单击form2上的enter按钮时,它最终会发布到相同的URL(这是在form1中定义的)。 form1正在发布而不是form2。

1 个答案:

答案 0 :(得分:0)

您可以分别使用java脚本提交它们。

的document.getElementById( “myForm会”)提交();

<input type="button" name ="enter" value="enter" OnClick="postData('FORMID')" />
function postData(formId){
    document.getElementById(formId).submit(); 
}