【坑】Firefox不支持window.event的解决办法
来源:互联网 发布:航信开票软件下载 编辑:程序博客网 时间:2024/05/22 17:45
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>无标题文档</title><script type="text/javascript">function Demo(evt) {var temp = window.event ? evt.keyCode : evt.which;alert(temp);}</script></head><body><input type="text" onKeyPress="Demo(event);"></body></html>
由于Firefox不支持window.event(这么好的浏览器你居然不支持。。。伤心了)
所以在获取event的时候要判断是否有这个对象先,我这里用的是
var temp = window.event ? evt.keyCode : evt.which;
。。。。(问CSDN的官人,怎么去掉这个代码的灰色背景)
这个evt.which和event有点相似(仅限于判断输入了那个键)
与之类似的还有Firefox的event.preventDefault()可以在IE下使用window.event.returnValue = false;来代替
0 0
- 【坑】Firefox不支持window.event的解决办法
- Firefox不支持removeNode及window.event解决办法
- 有关firefox不响应window.event的解决办法
- firefox下的window.event
- 解决firefox不支持window.event.returnValue = false
- 解决Firefox不支持event.keyCode 的方法
- Firefox不支持event解决方法
- Firefox不支持event解决方法
- Firefox不支持event解决方法
- Firefox不支持event解决方法
- Firefox不支持event解决方法
- Firefox不支持event解决方法
- Firefox下的window.event问题
- window.event兼容firefox
- javascript,firefox,window,event,srcelement firefox下的window.event.srcelement;
- FF 中 window.event 的解决办法总结
- firefox 默认不支持 window.close();
- firefox不支持IE的window.attachEvent的实现方法
- poj1144( 求割点数)
- 《Python 核心编程》之第三章习题 3.12
- 回顾数据库视频(select)
- HDU 4994 Revenge of Nim (博弈)
- 平板蓝牙测试与移植
- 【坑】Firefox不支持window.event的解决办法
- mysql中文乱码问题的解决
- 基于Ubuntu 14 LTS的LAMP开发环境搭建
- STL algorithm算法find_first_of(18)
- system()函数
- HDU4994-Revenge of Nim(博弈)
- FS210无线网卡驱动移植
- Java transient
- 程序员面试、算法研究、编程艺术、红黑树、数据挖掘5大系列集锦