<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
<%@includefile="../../common/include_tag.jsp"%>
<%@includefile="../../common/page_var.jsp"%>
<!DOCTYPEHTML>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8">
<title><%=pageTitle%>-用户登录</title>
<%@includefile="../../common/page_head.jsp"%>
<linkrel="stylesheet"type="text/css"
href="<s:urlvalue='/css/common_green.css'/>"/>
<scripttype="text/javascript"src="<s:urlvalue='/js/jquery.min.js'/>"></script>
<scripttype="text/javascript"src="<s:urlvalue='/js/common.js'/>"></script>
<styletype="text/css">
.logo{
padding-top:20px;
padding-left:20px;
padding-right:20px;
padding-bottom:20px;
font-size:28px;
}
.top{
padding-bottom:100px;
}
.login{
line-height:32px;
}
.content{
width:350px;
margin:15pxautoauto;
padding:50px50px;
border:2pxsolid#ccc;
border-radius:10px;
box-shadow:0030px#ccc;
}
.bottom{
padding-top:100px;
}
.button{
margin-top:10px;
margin-left:105px;
}
.update{
margin:0auto;
padding:0;
width:98%;
}
.updatetd{
margin:0;
height:30px;
padding:5px;
}
.update.name{
text-align:right;
}
.title_div{
width:350px;
}
body{
background:url("<s:urlvalue='/images/gray_bg.png'/>")00
repeat-y#F6F6F6;
}
</style>
<scripttype="text/javascript">
$(function(){
pilicat.title2div('title2div');
pilicat.keysubmit('form1','submit',true);
});
</script>
</head>
<body>
<divclass="logo">首都机场空地自动化协同决策系统</div>
<divclass="roundedtable">
<divclass="top"></div>
<divclass="content">
<formid="form1"action="<s:urlvalue='/u/ulogin'/>"method="post">
<divalign="center"><spanstyle="color:red;">${captcha}</span></div>
<tableclass="tabletable-borderedtable-striped"style="width:310px;padding-left:50px;">
<tbody>
<trclass="login">
<td><span>账号:</span></td>
<td><inputtype="text"id="userName"name="userName"
class="inputrounded"value=""placeholder="账号"/></td>
</tr>
<trclass="login">
<td><span>密码:</span></td>
<td><inputtype="password"id="passWd"name="passWd"
class="inputrounded"value=""placeholder="密码"/></td>
</tr>
<trclass="login">
<td><span>验证码:</span></td>
<td><inputtype="text"id="captcha"name="captcha"size="5"maxlength="5"class="inputrounded"value=""placeholder="验证码"/>
<imgid="captcha"style="cursor:pointer;cursor:hand;margin-top:-5px;margin-right:-10px;"align="middle"
onclick="this.src='<s:urlvalue='/u/captcha.htm'/>?'+Math.random();"
src="<s:urlvalue='/u/captcha.htm'/>">
</td>
</tr>
<trclass="login">
<tdcolspan="2">
<aid="submit"class="submit"href="javascript:;"onclick="submitForm();">登录</a>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<divclass="bottom"></div>
</div>
<%@includefile="../../common/bottom.jsp"%>
</body>
</html>
解决方案:
把form表单放在一个div里面,然后对这个div监听事件$("#id").keydown(function(){});
#*#监听回车事件
document.onkeydown=function(){
if(event.keyCode==13){
//这里提交你的表单
$('#ff_login').submit();
}
}
#*#页面编写js脚本进行监听。。。
#*#js监听enter事件#*#
把form表单放在一个div里面,然后对这个div监听事件$("#id").keydown(function(){});
#*#获取焦点监听enter#*#
监听整个body的keypress事件,如果是回车键,激发submit按钮的click事件,当然你的click事件中会有相关的数据验证之类的,如果验证不过,不会提交。
|