Return to Snippet

Revision: 50423
at August 20, 2011 20:48 by alberomo


Initial Code
function highlightRows() {
  if(!document.getElementsByTagName) return false;
  var rows = document.getElementsByTagName("tr");
  for (var i=0; i<rows.length; i++) {
    rows[i].onmouseover = function() {
      this.style.fontWeight = "bold";
    }
    rows[i].onmouseout = function() {
      this.style.fontWeight = "normal";
    }
  }
}

Initial URL

                                

Initial Description
A JS function that makes bold the text of table rows ("tr" elements) when you "mouseover" them. It takes no arguments.

From book Dom Scripting by Jeremy Keith.

Initial Title
highlightRows function

Initial Tags
javascript

Initial Language
JavaScript