Simple code to change background color and color of your text on mouse-over by Javascript.
You can change any CSS attribute bye this code.
var howervar= document.getElementsByClassName("class-name"); if (howervar!= null) { if (howervar[0] != null) { howervar[0].style.backgroundColor = "#365890"; howervar[0].style.color = "#FFFFFF"; } for (var i = 0; i < tbl.length; i++) { howervar[i].onmousemove = function () { this.style.backgroundColor = "#365890"; this.style.color = "#FFFFFF"; }; howervar[i].onmouseout = function () { this.style.backgroundColor = ""; this.style.color = ""; }; } }
Be the first to comment.