Hello, how can I change the background color of current element using plain javascript? for instance
<li onmouseover="this.backgroundColor:#000;">something</li>
This doesn't work, but you will get the idea what I want to do. Thank you
Hello, how can I change the background color of current element using plain javascript? for instance
<li onmouseover="this.backgroundColor:#000;">something</li>
This doesn't work, but you will get the idea what I want to do. Thank you
Almost there.
<li onmouseover="this.style.backgroundColor='#000';">something</li>
this.style.backgroundColor= 'black';
Or if you can, better in simple CSS:
li:hover { background-color: black; }
CSS hover
would probably be the most elegant solution, there is an IE6 fix for this:
csshover.htc
But if it were me I would use jQuery, and it would provide you excellent cross-browser support.