How about trying one last thing... how about instead of using the row
reference you get back from insertRow(), instead do a getElementById() to
get a new reference and try setting the handlers on that.

I'm grabbing at straws here admittedly, but it might be worth a try.  I've
seenstranger things :)

Incidentally, I found some code I wrote doing the same thing and although
I'm not using setAttribute (I think your right by the way about that being
the more standard-compliant way to do this) it does work.  That doesn't
much help of course :)  My code is virtually identical to yours too, in
fact it IS identical in the part that actually creates the table.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, April 28, 2005 8:12 am, [EMAIL PROTECTED] said:
> Okay Frank I gave it a shot and still nothing.
> I believe that the setAttribute is the proper way according to the DOM
> API.
> The other way may be supported depending on the browser.
>
> But in the end it is still not working.
> I'm thinking of an alternate solution, since the page is complete except
> for the damn mouse handlers.
> It would be a drag if I have to drop this feature since the web
> application has it in all of the pages... but this is the first dynamic
> page.
> I'm wondering if creating a global handler for mouse events would help.
>
> - Glenn
>
>
>
>
> "Frank W. Zammetti" <[EMAIL PROTECTED]>
> 27/04/2005 05:13 PM
> Please respond to
> "Struts Users Mailing List" <user@struts.apache.org>
>
>
> To
> Struts Users Mailing List <user@struts.apache.org>
> cc
>
> Subject
> Re: [OT] DOM & JavaScript
> Classification
>
>
>
>
>
>
>
>
> Interesting indeed... How about trying this... change the two lines that
> dynamically add the mouse handlers to:
>
> row.onMouseOver = "this.className = 'hilite';";
> row.onMouseOut = "this.className = 'rowNormal';";
>
> I'm not 100% sure what the capitalization should be of the property your
> setting (i.e., row.onMouseOver vs. row.onmouseover vs. something else),
> but give that a shot... any time I've done dynamic table creation I
> don't remember ever using setAttribute() at all, I think I've written
> code like the above.
>
> Frank
>
> [EMAIL PROTECTED] wrote:
>> Curiously... the mouse events are all in lowercase when they are shown
> in
>> the dump.
>> <TBODY>
>> <TR>
>> <TD class=tableHeader colSpan=2>Effective Date</TD>
>> <TD class=tableHeader width=200>CWW Schedule Type</TD>
>> <TD class=tableHeader id=calendarAnchor align=middle
> width=74>Delete</TD>
>> <TD width=136></TD></TR>
>>
>> - - - - - This is from the JSP - - - - - - -
>> <TR class=rowNormal onmouseover="this.className = 'hilite'"
>> onmouseout="this.className = 'rowNormal'" valign="top">
>> <TD id=c00 width=154>03 January 2004 </TD>
>> <TD id=c01 width=16><A onclick="lineId='c00';
>> calendar.showCalendar('calendarAnchor', '2005-04-27'); return false;"
>> href="#"><IMG height=16 src="/hronline/images/calendar.jpg" width=16
>> border=0> </A></TD>
>> <TD id=c02><SELECT class=dropdowns2 id=s0
>> onchange="addTableRow('historyTable','s0')"
>> name=historyItems[0].scheduleTypeId><OPTION value=00></OPTION> <OPTION
>> value=01 selected>1 Week Cycle</OPTION> <OPTION value=02>2 Week
>> Cycle</OPTION> <OPTION value=03>3 Week Cycle</OPTION> <OPTION value=04>4
>
>> Week Cycle</OPTION> <OPTION value=05>Regular Week
>> Schedule</OPTION></SELECT> </TD>
>> <TD id=c03 align=middle><INPUT type=checkbox value=on
>> name=historyItems[0].delete> </TD>
>> <TD class=rowNormal id=c04><INPUT class=dropdowns2 id=d00
>> style="VISIBILITY: hidden" size=1 value=2004-01-03
>> name=historyItems[0].startDate> </TD></TR>
>>
>> - - - - - - - This is the row added dynamically - - - - - - -
>> <TR class=rowNormal onmouseover="this.className = 'hilite'"
>> onmouseout="this.className = 'rowNormal'" valign="top">
>> <TD id=c40></TD>
>> <TD id=c41><A onclick="lineId='c40';
>> calendar.showCalendar('calendarAnchor', '2005-04-27'); return false;"
>> href="
> http://nati02:5001/hronline/secure/WEB-INF/personal/timeAndAttendance/cWWHistory.jsp#
> "><IMG
>> height=16 src="http://nati02:5001/hronline/images/calendar.jpg"; width=16
>
>> border=0> </A></TD>
>> <TD id=c42><SELECT class=dropdowns2 id=s4
>> onchange="addTableRow('historyTable','s4')"
>> name=historyItems[4].scheduleTypeId><OPTION value=00 selected></OPTION>
>> <OPTION value=01>1 Week Cycle</OPTION> <OPTION value=02>2 Week
>> Cycle</OPTION> <OPTION value=03>3 Week Cycle</OPTION> <OPTION value=04>4
>
>> Week Cycle</OPTION> <OPTION value=05>Regular Week
>> Schedule</OPTION></SELECT> </TD>
>> <TD align=middle><INPUT type=checkbox value=on
>> name=historyItems[4].delete> </TD>
>> <TD class=rowNormal id=c44><INPUT class=dropdowns2 id=d40
>> style="VISIBILITY: hidden" size=1 value=2004-01-03
>> name=historyItems[4].startDate> </TD></TR></TBODY>
>>
>> - Glenn
>>
>>
>>
>>
>> "Frank W. Zammetti" <[EMAIL PROTECTED]>
>> 27/04/2005 04:27 PM
>> Please respond to
>> "Struts Users Mailing List" <user@struts.apache.org>
>>
>>
>> To
>> Struts Users Mailing List <user@struts.apache.org>
>> cc
>>
>> Subject
>> Re: [OT] DOM & JavaScript
>> Classification
>>
>>
>>
>>
>>
>>
>>
>>
>> Hmm... I notice that the JSP code is referencing onMouseOver, while your
>
>> Javascript is trying to set the attribute onmouseover... I wonder if the
>
>> capitalization difference is an issue?  Certainly, if setAttribute()
>> takes case into consideration that would do it.  You said the lines were
>
>> identical when you looked, but could it be you glossed over the
>> difference in capitalization? (I may have too).
>>
>> Frank
>>
>> [EMAIL PROTECTED] wrote:
>>
>>>Greetings,
>>>
>>>Once again I call on my trusted community for insight !
>>>I'm adding a row to a table dynamically. All is working well except for
>>>one thing the Mouse events.
>>>
>>>Here is the code for adding a row to the table.
>>>There is more code that adds the cells to the table (not shown).
>>>...
>>>// 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
>>
>> +
>>
>>>"'");
>>>...
>>>}
>>>
>>>
>>>Here is the JSP code that creates the table row (at least one row is in
>>>the page), here the mouse events are working:
>>><tr valign="top" onMouseOver="this.className = 'hilite'" onMouseOut=
>>>"this.className = '<c:out value='${rowClass}'/>'" class="<c:out value=
>>>'${rowClass}'/>">
>>>
>>>If I add an alert that dumps the innerHTML of the table after the
>>>row/cells are added and I compare the two rows...
>>>They are the same.
>>>Why are the mouse events added dynamically not recongnized ?
>>>
>>>BTW, using IE 6.0.2900.2180.xpsp_sp2_rtm.040803-2158
>>>
>>>TIA,
>>>Glenn
>>>
>>
>>
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>


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

Reply via email to