Hi guys!
I have this code for change the color of the row when clicked work fine but,
I must add the html type on top of the page:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
**when I add the Doctype the script dont work.
What can I do for fix it???**
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language=javascript>
function changeColor(obj) {
newColor = (obj.style.backgroundColor == '') ? '#DDDDDD' : '';
rowObj = obj.parentElement;
for (i = 0; i < rowObj.childNodes.length; i++) {
rowObj.childNodes*.style.backgroundColor = newColor;
}
}
</script>
</head>
<body>
<table cellpadding=2 border=1>
<tr>
<td onclick='changeColor(this)'>1,1</td>
<td onclick='changeColor(this)'>1,2</td>
<td onclick='changeColor(this)'>1,3</td>
</tr>
<tr>
<td onclick='changeColor(this)'>2,1</td>
<td onclick='changeColor(this)'>2,2</td>
<td onclick='changeColor(this)'>2,3</td>
</tr>
<tr>
<td onclick='changeColor(this)'>3,1</td>
<td onclick='changeColor(this)'>3,2</td>
<td onclick='changeColor(this)'>3,3</td>
</tr>
<tr>
<td onclick='changeColor(this)'>4,1</td>
<td onclick='changeColor(this)'>4,2</td>
<td onclick='changeColor(this)'>4,3</td>
</tr>
</table>
</body>
</html>
thanks for help.