Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > mouseover a tables cell.

Reply
Thread Tools

mouseover a tables cell.

 
 
hari
Guest
Posts: n/a
 
      10-08-2004
I want to retreive the row number of a cell in the table when the
mouse is over that cell.
Can any one help?
 
Reply With Quote
 
 
 
 
Michael Winter
Guest
Posts: n/a
 
      10-08-2004
On 8 Oct 2004 13:05:46 -0700, hari <(E-Mail Removed)> wrote:

> I want to retreive the row number of a cell in the table when the
> mouse is over that cell.
> Can any one help?


With modern, DOM-supporting browsers, you can obtain the parent of the
table (the row), and get the row index of that via a property.

<tr>
<td onmouseover="getRowIndex(this);">
...


function getRowIndex(cell) {
var row = cell.parentNode;
if(row && 'undefined' != typeof row.rowIndex) {
return row.rowIndex; // or row.sectionRowIndex
}
}

The difference between rowIndex and sectionRowIndex is that the former
runs throughout the entire table. The latter restarts at the beginning of
each table section (TBODY, THEAD and TFOOT). Indicies are zero-order.

Hope that helps,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouseover problem with tables.... =?ISO-8859-15?Q?Andreas_Gr=E4ber?= HTML 8 07-31-2007 03:30 AM
How to get database metadata information (i.e. existing tables and columns in tables) Chris Brat Python 5 08-22-2006 05:25 PM
Tables within tables Otuatail HTML 7 08-02-2004 04:42 AM
Text after 2 tables actually appears between 2 tables ! Peter Bassett HTML 3 08-15-2003 06:46 PM
Re: LinkButtons and MouseOver Vidar Petursson ASP .Net 1 07-09-2003 07:10 AM



Advertisments