Internet explorer 错误类型为null或不是对象

Internet explorer 错误类型为null或不是对象,internet-explorer,javascript-events,Internet Explorer,Javascript Events,我的代码在Firefox中运行得很好,但我在IE上遇到了问题。当我执行时,我会出错,程序执行不正确。描述说clientX为null或不是对象 var cursorLocation = new function(){ this.x = 0; this.y = 0; //This function is called onmousemove to update the stored position this.update = function(e){ var w = window, b =

我的代码在Firefox中运行得很好,但我在IE上遇到了问题。当我执行时,我会出错,程序执行不正确。描述说clientX为null或不是对象

var cursorLocation = new function(){
this.x = 0;
this.y = 0;
//This function is called onmousemove to update the stored position
this.update = function(e){
    var w = window, b = document.body;
    this.x =  e.clientX + (w.scrollX || b.scrollLeft || b.parentNode.scrollLeft || 0);
    this.y = e.clientY + (w.scrollY || b.scrollTop || b.parentNode.scrollTop || 0);
}}      document.onmousemove=function(e){ cursorLocation.update(e); };

您不应该在javascript中执行
newfunction(){…}

这是你的错误


你应该这样做:


好的,我改变了,并尝试了这个,但它仍然不工作,在IEI使用;现在我错误地说,对象不支持此属性或方法。您当前的代码根本无法工作。。。
var someFunction = function(){....};

var someVariable = new someFunction();