登录按钮可以用enter键

This commit is contained in:
lizanle 2015-08-27 10:01:13 +08:00
parent 41a8f9d6a2
commit 0a898342d9
2 changed files with 21 additions and 3 deletions

View File

@ -47,6 +47,12 @@
$("#loginInBox").css({display:"none"});
}
});
// $('#regist_btn').bind('keyup', function(event) {
// if (event.keyCode == "13" && $("#signUpBox").css('display') == 'block')) {
// register();
// }
//});
function clearInfo(id, content) {
var text = $('#' + id);
if (text.val() == content) {
@ -206,7 +212,7 @@
</a></div>
<% end %>
<div class="loginInButton" >
<a href="javascript:void(0);" class="c_white db" onclick="$('#main_login_form').submit();">登录</a>
<a href="javascript:void(0);" id="login_btn" class="c_white db" onclick="$('#main_login_form').submit();">登录</a>
</div>
</div>
@ -248,7 +254,7 @@
</div>
我已阅读并接受<a href="<%= agreement_path %>" class="newsBlue"><u>Trustie服务协议</u></a>条款</div>
<div class="loginUpButton">
<a href="javascript:void(0);" class="c_white db" onclick="register();">注册</a>
<a href="javascript:void(0);" class="c_white db" id="regist_btn" onclick="register();">注册</a>
</div>
<% end %>

View File

@ -15,7 +15,19 @@
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
</head>
<
<script type="text/javascript" charset="utf-8">
$(function() {
$(document).keyup(function (e) {
var e = e || event,
code = e.which || e.keyCode;
if (code == 13 && $("#loginInBox").css('display') == 'block') {
e.preventDefault();
$('#main_login_form').submit();
}
});
});
</script>
<div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>