button提交表单 a标签提交表单

时间:2022-06-24 11:05:08
<form name="searchForm" id="searchForm" method="get" action="/ProductType?pageIndex=1">            
            <input type="text" value="" name="name" id="name"  placeholder="Enter text">
            <button onclick="form.submit()">submit1</button>
<button onclick="document.forms[0].submit()">submit2</button>
<button onclick="searchForm.submit()">submit3</button>
            <a onclick="document.searchForm.submit()" href="javascript:">submit1</a>
<a onclick="document.forms[0].submit()" href="javascript:">submit2</a>
<a onclick="document.getElementById('searchForm').submit();" href="javascript:">submit3</a>
<!-- onclick直接写脚本,href加javascript: -->
<a href="javascript:document.getElementById('searchForm').submit();">submit4</a>
</form>