Hi!
Has anybody managed to highlight table rows on a mouse over event?
In my old solution I used "mouseover" and "mouseout" event, but i need to get it to work with the Display Tag. I have tried a solution with:
<STYLE TYPE="text/css"> <!-- tr:hover { background-color: rgb(153,153,204); text-decoration: none; } //--> </style>
That works with firefox, but not with IE. Does anybody have any suggestion on how to get highlight tablerows with the displaytag and internet exporer?
I use JavaScript to do this - note that this function will also make your rows clickable:
function highlightTableRows(tableId) { var previousClass = null; var table = document.getElementById(tableId); var tbody = table.getElementsByTagName("tbody")[0]; if (tbody == null) { var rows = table.getElementsByTagName("tr"); } else { var rows = tbody.getElementsByTagName("tr"); } // add event handlers so rows light up and are clickable for (i=0; i < rows.length; i++) { rows[i].onmouseover = function() { previousClass=this.className;this.className+=' over' }; rows[i].onmouseout = function() { this.className=previousClass }; rows[i].onclick = function() { var cell = this.getElementsByTagName("td")[0]; var link = cell.getElementsByTagName("a")[0]; location.href = link.getAttribute("href"); this.style.cursor="wait"; } } }
Log in to post a comment.
Hi!
Has anybody managed to highlight table rows on a mouse over event?
In my old solution I used "mouseover" and "mouseout" event, but i need to get it to work with the Display Tag. I have tried a solution with:
That works with firefox, but not with IE. Does anybody have any suggestion on how to get highlight tablerows with the displaytag and internet exporer?
I use JavaScript to do this - note that this function will also make your rows clickable:
function highlightTableRows(tableId) {
var previousClass = null;
var table = document.getElementById(tableId);
var tbody = table.getElementsByTagName("tbody")[0];
if (tbody == null) {
var rows = table.getElementsByTagName("tr");
} else {
var rows = tbody.getElementsByTagName("tr");
}
// add event handlers so rows light up and are clickable
for (i=0; i < rows.length; i++) {
rows[i].onmouseover = function() { previousClass=this.className;this.className+=' over' };
rows[i].onmouseout = function() { this.className=previousClass };
rows[i].onclick = function() {
var cell = this.getElementsByTagName("td")[0];
var link = cell.getElementsByTagName("a")[0];
location.href = link.getAttribute("href");
this.style.cursor="wait";
}
}
}