Firefox“window.event未定义”错误 [英] Firefox "window.event is undefined" error
本文介绍了Firefox“window.event未定义”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function postBackByObject(e){
var o = window.event.srcElement || e.target;
if(o.tagName ==INPUT&& o.type ==checkbox){
__doPostBack(,);
我使用的onclick = postBackByObject();
。
但在Firefox 21中出现此错误:
$ b
TypeError:窗口。事件是未定义的
我的错误是什么?
解决方案那是因为它。 window.event
适用于旧版本的IE。
执行此操作的典型方法是:
function postBackByObject(e){
e = e || window.event;
var o = e.srcElement || e.target;
// ...
}
I have this script:
function postBackByObject(e) {
var o = window.event.srcElement || e.target;
if (o.tagName == "INPUT" && o.type == "checkbox") {
__doPostBack("", "");
}
}
I use this script with onclick="postBackByObject();"
.
but in Firefox 21 I get this error:
TypeError: window.event is undefined
what is my wrong?
解决方案 That's because it is. window.event
is for older versions of IE.
The typical way to do this is:
function postBackByObject(e) {
e = e || window.event;
var o = e.srcElement || e.target;
// ...
}
这篇关于Firefox“window.event未定义”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文