好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

键盘enter事件一个页面绑定多次_html/css_WEB-ITnose





键盘enter事件一个页面绑定多次




//注册键盘事件
document.onkeydown = function(e) {
//捕捉回车事件
var ev = (typeof event!= 'undefined') ? window.event : e;
if(ev.keyCode == 13 && document.activeElement.id == "msg") {//activeElement活动事件,该事件只可以使用于输入域中
alert("获取到内容:" + document.activeElement.value);
}else if(ev.keyCode==13&& document.activeElement.name=='temp1'){
$("#temp").click();
}
}


function show1(){
$("#temp").css("color","red");
}




查看更多关于键盘enter事件一个页面绑定多次_html/css_WEB-ITnose的详细内容...

  阅读:39次