开发者

Microsoft JScript runtime error: Object doesn't support this property or method

开发者 https://www.devze.com 2023-02-15 16:26 出处:网络
I am writing a Web Application in ASP.NET using C#. Whenever I run it, I get three types of Runtime开发者_运维问答 Javascript Errors.

I am writing a Web Application in ASP.NET using C#. Whenever I run it, I get three types of Runtime开发者_运维问答 Javascript Errors.

My Problem is that even though I am running a new Web Application with out any modification, then I also get the same errors.

These are the errors:

  1. Microsoft JScript runtime error: Object doesn't support this property or method at document.addEventListener("mousemove", updateLastMouseMoveCoordinates, false);

  2. Microsoft JScript runtime error: Object expected at divSurveyInit();

  3. Microsoft JScript runtime error: Object doesn't support this property or method at document.addEventListener("mousemove", updateLastMouseMoveCoordinates, false);


For IE versions < 9 you have to use the attachEvent method to add event listeners.


You can use attachEvent or addEventListener in an if...else for different versions of IE and/or cross browsers like this or similar:

if (document.addEventListener){
        document.addEventListener('mousemove', changeState, true);
        document.addEventListener('mouseout', stopScrollingIfOutsideWindow, true);
        document.addEventListener('mousedown', markMouseDown, true);
        document.addEventListener('mouseup', unmarkMouseDown, true);
} else if (document.attachEvent){
        document.attachEvent('onmousemove', changeState);
        document.attachEvent('onmouseout', stopScrollingIfOutsideWindow);
        document.attachEvent('onmousedown', markMouseDown);
        document.attachEvent('onmouseup', unmarkMouseDown);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消