onCLick on TD only works on image inside TD

T

TnaG

I have an onClick on a TD. If I click on an image inside the TD, the
onClick fires, however if i click anywhere else inside the TD nothing
happens.

Any ideas?
 
G

Grant Wagner

TnaG said:
I have an onClick on a TD. If I click on an image inside the TD, the
onClick fires, however if i click anywhere else inside the TD nothing
happens.

Any ideas?

<table>
<tr>
<td onclick="alert('hi');"><img src="about:blank"><span>Some
text</span></td>
</tr>
</table>

Tested and working here. If you click "Some text" in IE6SP1, Firefox
0.9.2 and Opera 7.52, the alert() appears.

Perhaps you could provide a URL or the smallest amount of code that
demonstrates this problem. Describe what browsers it is failing in and
what, if any, errors are occurring in those browsers.

Sometimes just breaking the problem down into the smallest reproducible
amount of HTML and Javascript reveals the source of the problem. For
example, you may have a DIV or other element on top of the table cell,
and the only part of the table cell actually exposed to the mouse is the
image.
 
T

Thomas 'PointedEars' Lahn

TnaG said:
I have an onClick on a TD. If I click on an image inside the TD, the
onClick fires, however if i click anywhere else inside the TD nothing
happens.

Any ideas?

Any source code? What user agent(s) have you tested with?


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top