0

Recently, we upgraded our website from .NET 3.5 to 4.0. After doing so, we noticed something very weird happening in legacy versions of IE. IE9 in standards view works as designed, however, any other version of IE gives us a weird error when typing into an asp textbox with a RequiredFieldValidator. In a .NET anonymous function that is found, we get the "Member not found." script error on this line:

event = event || window.event;

I've searched everywhere but have not found a solution. This only happens when we type in the textbox, and only on this page. Any help would be appreciated. This only happens in older version of IE, other browsers and IE9 seem to handle it perfectly fine.

0

2 Answers 2

2

Are you accessing event || window.event inside setTimeout function? if so, by that time the even might have lost and accessing the event will give you 'member not found' error..

1
  • Nice guess, but... If there were not window.event object, || would return undefined. Hence an attempt to use event variable later in the code would throw Can't find property X. Object is undefined or null-error.
    – Teemu
    Jul 28, 2012 at 12:32
0

Since you haven't posted your code, we can only guess what is going on.

The line throwing error is fine (assuming event being in function arguments), probably error is caused by the next line. IE throws Member not found error message, when you try to retrieve non-existing property of the event object.

I suppose there is keyup or keydown handler in your script, having a line something like this:

if (event.which == 13){ ... }

However, there is no which property in event object in older IEs, corresponding property is keyCode. So you need to check both:

var key=event.which || event.keyCode;
if (key == 13){ ... }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.