<body>
<form action="https://my.oschina.net/u/3285916" method="get" name="formOne" id="formId">
name:<input type="text" name="name">
pwd:<input type="password" name="pwd"><br/>
<input type="button" value="1提交" onclick="document.forms[0].submit()">
<input type="button" value="2提交" onclick="this.form.submit()">
<input type="button" value="3提交" onclick="document.formOne.submit()">
<input type="button" value="4提交" onclick="document.getElementById('formId').submit()">
<input type="submit" value="5提交">
<input type="submit" value="6提交" onclick="doSubmit()">
</form>
<script type="text/javascript">
function doSubmit(){
//表单提交
document.forms.submit();
}
</script>
</body>
From表单提交的几种方式
点赞
收藏