TheConeHead
Programmer
Is there a way to click on a cell and have the whole row highlighted (ie change bgcolor) ... I know, I know you hate tables, but that is how I am doing it...
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<html>
<head>
<script language=javascript>
function highlightRow(obj) {
var rowObj = obj.parentNode;
for (i = 0; i < rowObj.childNodes.length; i++) {
rowObj.childNodes[i].style.backgroundColor = '#ffff00';
}
}
</script>
</head>
<body>
<table border=1>
<tr><td onclick="highlightRow(this)">this</td><td onclick="highlightRow(this)">is</td><td onclick="highlightRow(this)">row</td><td onclick="highlightRow(this)">one</td></tr>
<tr><td onclick="highlightRow(this)">this</td><td onclick="highlightRow(this)">is</td><td onclick="highlightRow(this)">row</td><td onclick="highlightRow(this)">two</td></tr>
<tr><td onclick="highlightRow(this)">this</td><td onclick="highlightRow(this)">is</td><td onclick="highlightRow(this)">row</td><td onclick="highlightRow(this)">three</td></tr>
<tr><td onclick="highlightRow(this)">this</td><td onclick="highlightRow(this)">is</td><td onclick="highlightRow(this)">row</td><td onclick="highlightRow(this)">four</td></tr>
</table>
</body>
</html>