[EMAIL PROTECTED] wrote:
> // Only add a row when changing the last row of the table
> if ("s"+(rowWithData) == selectId) {
>         var row = table.insertRow(lastRowInTable);
>         var className = "rowNormal";
> 
>         if (lastRowInTable % 2 == 0) {
>                 className = "rowAlternate";
>         }
>         row.className = className;
>         row.setAttribute("onmouseover", "this.className = 'hilite';");
>         row.setAttribute("onmouseout", "this.className = '" + className + 
> "'");


That's not how it works (not in IE at least). The event attributes'
values should be event listeners (i.e. functions), not strings of
javascript code.

Try this:

function changeClassName(e) {
  if (!e) e=window.event;
  getEventTarget(e).setAttribute("class", "hilite"); // DOM-compliant
  getEventTarget(e).setAttribute("className", "hilite"); // MSIE
}

row.onmouseover = changeClassName; // without quotes nor parentheses

function getEventTarget(e) {
    if (e.srcElement) return e.srcElement;
    else return e.currentTarget;
}

Note: the code above aims to be cross-browser, as IE behaves completely
differently from any other browser.

BTW, all event attributes are *lower case*: onmouseover, onmouseout (not
onMouseOver...)

Hope this helps.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to