Have you seen the dimensions plugin? It might solve the problem.
http://jquery.com/plugins/project/dimensions

Glen

On 6/19/07, Matt Conrad <[EMAIL PROTECTED]> wrote:


New to Javascript, new to jQuery.

I'm trying to find the cleanest way to get the position (x, y) of a
table cell that is clicked.  I'll eventually post the coordinates back
to the server.

I have some code that gives me the clicked positions in Firefox but
fails completely in IE (target.cellIndex is null or not an object).
Code is at the bottom of this post.

Is there anything already built into jQuery that I can use to get this
info in a browser-independent way?

If not, do you guys have another recommended approach for getting x, y
from a table based on onclick()?

Matt

[the below works in FF but not in IE]

<table onclick="handleClick(event)">

function handleClick(e)
{
  var t;
  if (e && ((t = e.target) || (t = e.srcElement)))
  {
    alert(e.target.cellIndex + ', ' + e.target.parentNode.rowIndex);
  }
}

Reply via email to