JS monitor input box keys
//回车事件绑定
$('#search_input').bind('keyup', function(event) {
if (event.keyCode == '13') {
//处理按回车键后的逻辑
}
});
JS listening on a DIV area
$("#div").bind("keydown", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == '13') {
//处理按回车键后的逻辑
}
});
JS monitor body region
document.onkeydown = function (event) {
var e = event || window.event;
if (e && e.keyCode == 13) {
//处理按回车键后的逻辑
}
}
[Java interview questions and answers To arrange recommend
- Basic and Grammar
- set
- network programming
- Concurrent Programming
- Web
- Safety
- Design Patterns
- frame
- Algorithms and Data Structures
- abnormal
- File parsing and generation
- Linux
- MySQL
- Oracle
- Redis
- Dubbo