Link to home
Start Free TrialLog in
Avatar of cavtel
cavtel

asked on

Not implemented error in IE

Hi,

I'm having this problem just for IE (I'm using IE8). The code works fine in all the other browsers (Firefox, Safari, Chrome). Here is a snippet

// I've a div with id='div_a'

window.onload = function() {
  var elem = document.getElementById('div_a');
  elem.onclick = dosomething(elem);
}

function dosomething(obj) {
  if( !obj ) return;
  obj.onmousedown = function() {
    // doing something over here
  }
}

Please note that window.onload is actually pointing to a function object. It is the same as doing the following (which yielded the same 'Not implemented' error in IE):-

window.onload = init;

function init() {
  var elem = document.getElementById('div_a');
  elem.onclick = dosomething(elem);
}

ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
HOWEVER I would not try to sset the onmousedown event handler in an onclick event. That is asking for trouble
So why a "B" ?
Avatar of cavtel
cavtel

ASKER

My apologies. I thought I had clicked on 'A' and soon I realized my mistake. I don't think it is possible to re-assign a grade? or is it?
No problem. Unaccepted
Avatar of cavtel

ASKER

I was originally trying to execute a mousedown event when the user triggered a onclick event. But I agree it's better not to mix different event triggers with one another. That's what I ended up doing anyway.