Can I get the html element in an event trigger function in javascript?

advertisements

Edit: I need to mention that I do not want to use jQuery. This is my code. I need to access the element which triggered the event such that I don't have to make two different functions for each html element.

document.getElementById("login").onmouseover = turnWhite;

function turnWhite(e){
}

I need maybe something like this. Don't know if it's possible though.

function turnWhite(e){
    e.HTMLEL.style.color = "white";
}

Is this possible?


According to javascripter.net

  • e.srcElement in Internet Explorer
  • e.target in most other browsers.