js implements a method of changing color over a table row with the mouse

  • 2020-06-12 08:27:25
  • OfStack

An example of js shows how to change the color of a table row with the mouse. Share to everybody for everybody reference. Specific implementation methods are as follows:


<script type=text/javascript>
<!--
(function(){
 var rows = document.getElementById("listdata");
 var add = function(){
 this.style.backgroundColor="#f3f3f1";
 };
 var del = function(){
 this.style.backgroundColor="#fff";
 };
 for(var m=rows.firstChild;m!=null;m=m.nextSibling){
 m.onmouseover = add;
 m.onmouseout = del;
 }
})();
-->
</script>

Hopefully, this article has been helpful in your javascript programming.


Related articles: