Tom Frantz wrote:
I have a table in IE 6.0 listing several items where clicking on a row will
bring up another window showing details for that item. Clicking a
particular button on the detail window will change how that item appears on
the initial list screen by altering it's background color, class name, and
default cursor.
The problem I'm having is this -- sometimes it works and sometimes it
doesn't.
There doesn't appear to be any rhyme or reason as to when it works and when
it doesn't. Below is a code snippet showing how I'm going about making
these changes. Any input would be appreciated.
trNode.className = "approved";
trNode.style.backgroundColor = approvedColor;
trNode.style.cursor = "default";
Your code as posted is OK, below is a small bit of play code to test
it. It's reliable in IE as far as I can tell.
You may need to post a bit more of your code - usually a minimal
implementation that still shows the error (which may lead you to fixing
it...)
Rob.
<html><head>
<title>test code</title>
<script type="text/javascript">
function doChange(trNode) {
var approvedColor = 'blue';
trNode.className = "approved";
trNode.style.backgroundColor = approvedColor;
trNode.style.cursor = "default";
}
</script>
<style type="text/css">
..approved
{font-family: sans-serif; font-size: 2em;}
..notapproved
{font-family: courier; font-size: 1em;
background-color: pink; cursor: pointer;}
td
{border: thin solid red;}
</style>
</head>
<body>
<table>
<tr>
<td onclick="doChange(this);"
class="notapproved">this is the td</td>
</tr>
</table>
</body></html>