jsp中回車提出フォーム
3024 ワード
js方法:
jspコード:
function tijiao() {
var loginForm = document.getElementById("loginForm");
if (loginForm.login_name.value == "") {
alert(" ");
return;
}
if (loginForm.pwd.value == "") {
alert(" ");
return;
}
if (loginForm.validatacode.value == "") {
alert(" ");
return;
}
loginForm.action = "<%=path%>/memberlogin.action";
loginForm.submit();
}
jspコード:
<form id="loginForm" method="post" onsubmit="javascript:tijiao()">
<ul>
<li class="login_L_1"></li>
<li class="login_L_2">
<div align="center">${errMsg}</div>
<p> :
<select name="login_type">
<option value="loginname"> </option>
<option value="email"> </option>
</select>
</p>
<p> :<input type="text" value="" name="login_name" size="27"/></p>
<p> :<input type="password" value="" name="pwd" size="27"/></p>
<p> :<input type="text" value="" name="validatacode" size="10"/>
<img src="<%=path %>/getImage.action" id="validataimage" border="0"/>
</p>
<p>
<input type="submit" name="Submit" value=" " onclick="javascript:tijiao();"
class="blueButtonCss"/>
<input type="button" name="Submit3" value=" " onclick="javascript:chongzhi();"
class="blueButtonCss"/>
</p>
</li>
<li class="login_L_3"></li>
</ul>
</form>