Temporary Onmouseover
- by 2x2p1p
Hi guys :)
Css "over" selector applys a temporary style to an element, it isn't definitive:
div:hover {
background-color: red;
}
I can use the same thing with javascript but it is a bit complicate and impossible for several elements:
var elem = document.getElementByTagName ("div")[0];
elem.onmouseover = function () {
this.style.backgroundColor = "red";
}
elem.onmouseout = function () {
this.style.backgroundColor = "transparent";
}
There is a better way ? Something like this:
document.getElementByTagName ("div")[0].ontemporarymouseover = function () { // LoL
this.style.backgroundColor = "red";
}
Thanks