我是靠谱客的博主 清秀篮球,这篇文章主要介绍input框触发回车事件,现在分享给大家,希望可以做个参考。

 

window.event只能在IE下运行,不能在firefox下运行,这是因为firefox的event只能在事件发生的现场使用。   
在firefox里直接调用event对象会报undefined。
兼容解决方式:

<input type="text" οnkeydοwn="keyup_submit(event);">
<script>
function keyup_submit(e){
var evt = window.event || e;
if (evt.keyCode == 13){
//回车事件
  console.log(e.target.attributes);

}
}
</script>

 

如果要获取元素的属性等:

 

console.log(e.target.attributes);

 

转 : https://www.cnblogs.com/houweijian/p/5808978.html

 

转载于:https://www.cnblogs.com/fps2tao/p/10486956.html

最后

以上就是清秀篮球最近收集整理的关于input框触发回车事件的全部内容,更多相关input框触发回车事件内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部