最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Microsoft JScript runtime error: Object doesn't support this property or method - Stack Overflow

programmeradmin2浏览0评论

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);

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);

Share Improve this question edited Nov 3, 2011 at 7:28 Sai Kalyan Kumar Akshinthala asked Mar 8, 2011 at 6:28 Sai Kalyan Kumar AkshinthalaSai Kalyan Kumar Akshinthala 11.8k8 gold badges45 silver badges68 bronze badges 1
  • 2 Errors 1 and 3 are identical. Copy/paste error? – Mat Commented Mar 8, 2011 at 6:33
Add a ment  | 

2 Answers 2

Reset to default 2

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)

  1. 暂无评论