Connecting Tech Pros Worldwide Forums | Help | Site Map

Safari mousedown event

mitch
Guest
 
Posts: n/a
#1: Dec 7 '05
I have a big <table> and I have added an onmousedown handler.
When I get back the event in IE and Firefox, the individual <td>
element appears in window.event.srcElement (IE) and in
event.target (Firefox). However in Safari the target is just the
<table>, not the <td>.

I need to get back the <td> associated with the event, and I would
not like to put an onmousedown handler on each table cell because
there are a lot of them. Does anybody know how I can get the event
and figure out which table cell was clicked? Thanks.


mitch
Guest
 
Posts: n/a
#2: Dec 7 '05

re: Safari mousedown event


P.S. The exact same thing happens with onmouseclick as
onmousedown on Safari: the event's target is the <table>
rather than the <td>.

mitch
Guest
 
Posts: n/a
#3: Dec 7 '05

re: Safari mousedown event


Sorry to answer my own post (again) but I've found the
fix, at least for the first of my project's Safari problems.
In my table, if a cell is completely empty, the event was coming back
with its target set to the <table> in Safari. If I add an &nbsp;
to the empty table cell, now the mouse events come back
pointing to the <td> element. This is a small difference between
Safari and the other browsers, where the event target is the <td>
element even if the cells are empty.

Closed Thread