javascript - Temporary Onmouseover -


CSS "hover" selector implements a temporary style to an element, it is not certain:

  div: hover {background-color: red; }  

I can do the same thing with javascript but it is a bit complex and impossible for many elements:

  var elem = document.getElementsByTagName ("Div") [0]; Elem.onmouseover = function () {this.style.backgroundColor = "red"; } Elem.onmouseout = function () {this.style.backgroundColor = "transparent"; }  

Is there a better way? Something like this:

  document.getElementsByTagName ("div") [0]. Intermissionsover = function () {// LoL this.style.backgroundColor = "red"; }     

/ P>

  $ ("element"). Bind ({mouseover: function () {}, mouseout: function () {}}); $ ("Element"). Unbind ('mouseover mouseout');  

I hope this is what is needed for you.


Comments