form表单中如何使用a标签代替button或commit进行数据提交?

1、申明form的id

2、在<a>标签内书写

onclick="document:loginForm.submit()"

 

具体用例:

<form class="sui-form" action="/login" method="post" id="loginForm">

	<div class="input-prepend"><span class="add-on loginname"></span>
	    <input id="prependedInput" name="username" type="text" placeholder="邮箱/用户名/手机号" class="span2 input-xfat">
	</div>

	<div class="input-prepend"><span class="add-on loginpwd"></span>
		<input id="prependedInput" name="password" type="password" placeholder="请输入密码" class="span2 input-xfat">
	</div>

	<div class="setting">
		<div id="slider">
			<div id="slider_bg"></div>
				<span id="label"></span> <span id="labelTip">拖动滑块验证</span>
			</div>
		</div>
    <div class="logined">
    <!-- a标签中使用onclick事件 -->
	<a class="sui-btn btn-block btn-xlarge btn-danger" onclick="document:loginForm.submit()" target="_blank">登&nbsp;&nbsp;录</a>
	</div>

</form>

 

展开阅读全文

没有更多推荐了,返回首页