Q:

Clicking a Link in td with Watir

I'm trying to click an image in  with a Watir script.   Here's the source code for what I'm trying to click:
<td align="right">
   <a onclick="confirmAndSubmit('Exit application?', ' saveAndExit')"
   onmouseover="style.cursor='hand'">
   <img src="/images/exitBlue.gif" align="bottom"></img>
   </a>
</td>

Watir seems to be unable to locate the element based on my code.   It seems like I have to write sort of a complex statement with the arguments.   I've tried 
$b.td(:img, "src='/images/exitBlue.gif'").click

as well as
$b.element(:css, "td[onClick='confirmAndSubmit('Exit application?', ' saveAndExit')']").click

but nothing seems to locate the data in the table.   Any suggestions on how to go about clicking this? 

A:

I found the solution with a bit of trial and error.   As mentioned in the comments, the image was inside nested tables.   I targeted the div inside the first table and was able to get to it.   The element.flash method was invaluable in troubleshooting.   The code I was originally using was only getting inside the first cell of the table and therefore couldn't find the image.   The code that worked for me:
$b.div(:id, "bar").table.td(:index => 1).image.click_no_wait

