html:
....
<form>
<input type="submit" value="登录" id="user_login_submit" />
</form>
js代码:
<script type="text/javascript">
$(function(){
$(document).keydown(function(event){
if(event.keyCode ==13){
$('#user_login_submit').trigger('click');
}
});
....
<form>
<input type="submit" value="登录" id="user_login_submit" />
</form>
js代码:
<script type="text/javascript">
$(function(){
$(document).keydown(function(event){
if(event.keyCode ==13){
$('#user_login_submit').trigger('click');
}
});
})
或者
$(docuement).ready(function(){
$(document).keyup(function (evnet) {
if (evnet.keyCode == '13') {
alert('哈哈');
}
});
</script>