Created
March 7, 2012 03:58
-
-
Save hsquareweb/1990855 to your computer and use it in GitHub Desktop.
CSS/JS: Table TD Hover For IE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
td.hovered {background: #ffdb7f !important; cursor: pointer !important;} | |
// ******************************************************************** | |
// TABLE TD HOVER FOR IE | |
// ******************************************************************** | |
if(document.getElementsByTagName) { | |
(function() { | |
var className = 'hovered', | |
pattern = new RegExp('(^|\\s+)' + className + '(\\s+|$)'), | |
//Replace this:document.getElementsByTagName('tr');with this:document.getElementById('id_of_your_table').getElementsByTagName('tr'); to restrict to a particular table. | |
rows = document.getElementsByTagName('td'); | |
for(var i = 0, n = rows.length; i < n; ++i) { | |
rows[i].onmouseover = function() { | |
this.className += ' ' + className; | |
}; | |
rows[i].onmouseout = function() { | |
this.className = this.className.replace(pattern, ' '); | |
}; | |
} | |
rows = null; | |
})(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment