T
TC
Hi
I'm trying to change the background colour of a table row when a user
puts a mouse over it or clicks on it, but for some reason the code
does not seem to work in IE 6 even though I can alter the alignment
attribute in IE 6. Heres a cut down version of the code I'm using
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function changeRowBgClick(rowID)
{
theRow = document.getElementById(rowID);
var vBgColor = theRow.getAttribute("bgcolor");
//alert(vBgColor == offColor);
if (vBgColor == "#ffffff")
{
alert("1 >"+theRow.getAttribute("bgcolor"));
theRow.setAttribute("bgcolor", "#000000");
theRow.setAttribute("align", "center");
alert("2 >"+theRow.bgcolor);
alert("3 >"+theRow.getAttribute("bgcolor"));
}
else
{
theRow.setAttribute("bgcolor",offColor);
}
alert('end of click function');
}
-->
</script>
</head>
<body>
<table border="1" width="100%">
<tr>
<td align="right" bgcolor="#ffffff" id="row<%=vID%>"
onClick="changeRowBgClick('row<%=vID%>')">
testing
</td>
</tr>
</table>
</body>
</html>
If you run this code your see that the word testing moves to the
center but in IE the background does not change, but this code works
fine in Mozilla.
I hope someone can help with this as I can't see why this would occur.
Tony Combe
I'm trying to change the background colour of a table row when a user
puts a mouse over it or clicks on it, but for some reason the code
does not seem to work in IE 6 even though I can alter the alignment
attribute in IE 6. Heres a cut down version of the code I'm using
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function changeRowBgClick(rowID)
{
theRow = document.getElementById(rowID);
var vBgColor = theRow.getAttribute("bgcolor");
//alert(vBgColor == offColor);
if (vBgColor == "#ffffff")
{
alert("1 >"+theRow.getAttribute("bgcolor"));
theRow.setAttribute("bgcolor", "#000000");
theRow.setAttribute("align", "center");
alert("2 >"+theRow.bgcolor);
alert("3 >"+theRow.getAttribute("bgcolor"));
}
else
{
theRow.setAttribute("bgcolor",offColor);
}
alert('end of click function');
}
-->
</script>
</head>
<body>
<table border="1" width="100%">
<tr>
<td align="right" bgcolor="#ffffff" id="row<%=vID%>"
onClick="changeRowBgClick('row<%=vID%>')">
testing
</td>
</tr>
</table>
</body>
</html>
If you run this code your see that the word testing moves to the
center but in IE the background does not change, but this code works
fine in Mozilla.
I hope someone can help with this as I can't see why this would occur.
Tony Combe