DOM Changes Won't Display

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Frantz

    DOM Changes Won't Display

    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.classNam e = "approved";
    trNode.style.ba ckgroundColor = approvedColor;
    trNode.style.cu rsor = "default";


  • RobG

    #2
    Re: DOM Changes Won't Display

    Tom Frantz wrote:[color=blue]
    > 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.classNam e = "approved";
    > trNode.style.ba ckgroundColor = approvedColor;
    > trNode.style.cu rsor = "default";
    >
    >[/color]

    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.classNam e = "approved";
    trNode.style.ba ckgroundColor = approvedColor;
    trNode.style.cu rsor = "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="doChan ge(this);"
    class="notappro ved">this is the td</td>
    </tr>
    </table>
    </body></html>

    Comment

    • Michael Winter

      #3
      Re: DOM Changes Won't Display

      On Mon, 22 Nov 2004 21:36:58 -0500, Tom Frantz <tomfrantz@comc ast.net>
      wrote:

      [snip]
      [color=blue]
      > trNode.classNam e = "approved";
      > trNode.style.ba ckgroundColor = approvedColor;
      > trNode.style.cu rsor = "default";[/color]

      There's nothing I can suggest code-wise without at least an example
      showing the problem (which you seem to be unable to supply). However,
      might I ask why the background colour and cursor styles aren't set as part
      of the CSS class? Can the "approved color" change according to some
      condition so a fixed value in the style sheet is inappropriate?

      Mike

      --
      Michael Winter
      Replace ".invalid" with ".uk" to reply by e-mail.

      Comment

      Working...