困得不行了 ,脑袋转不动了,大家直接拿代码用吧。。
document.onkeydown = function(e) {
var ev = (typeof event!= 'undefined') ? window.event : e;
if(ev.keyCode == 13 && document.activeElement.id == "") {//activeElement活动事件,该事件只可以使用于输入域中
console.log("内容111:" + document.activeElement.value);
}else if(ev.keyCode==13&& document.activeElement.id==''){
console.log("内容222:" + document.activeElement.value);
}
};
以上这篇js实现同一个页面,多个enter事件绑定的示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
Copyright © 2019- gamedaodao.com 版权所有 湘ICP备2022005869号-6
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务