473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

mouseover a tables cell.

I want to retreive the row number of a cell in the table when the
mouse is over that cell.
Can any one help?
Jul 23 '05 #1
2 1445
hari 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?


will this do it for you?

<script type="text/javascript">
function showrow(tbl_row){
alert(tbl_row);
}
</script>

<table>
<tr onmouseover="showrow('row1')">
<td>a</td>
<td>b</td>
</tr>
<tr onmouseover="showrow('row2')">
<td>e</td>
<td>f</td>
</tr>
<tr onmouseover="showrow('row3')">
<td>i</td>
<td>j</td>
</tr>
<tr onmouseover="showrow('row4')">
<td>m</td>
<td>n</td>
</tr>
</table>
Jul 23 '05 #2
On 8 Oct 2004 13:05:46 -0700, hari <si***********@tcs.com> 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.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Colin Steadman | last post by:
Help! I'm a stupid HTML bod and I dont do Javascript! I have a grey coloured table that displays certain columns in either red, green or orange to give meaning and emphasis to certain data. ...
1
by: Tony Farrell | last post by:
Hi everyone - I am trying to accomplish a task that i thought would be easy - and at this point - i'm starting to wonder... I have a table setup, one column, ten rows All the cells start...
2
by: Marita | last post by:
I know that you can change the cell background color on mouseover, but is there a way with stylesheets that a background image can be swapped? Thanks in advance for any advice! Marita
2
by: bidalah | last post by:
Hi everyone, I have a form that I created using tables. I want to create mouseover events which act on labels that are inside certain table cells so that when the mouse is over these label,...
1
by: Luis Esteban Valencia | last post by:
Is it possible to implement mouseover on a particular word in a datagrid (not mouseover on the entire cell)? For instance, assuming tha I have a 'Definitions' MSSQL table as such: Definitions...
1
by: Matt Colegrove | last post by:
Is there a way to apply a "mouseover" command to the cell level of a GridView? I can do it at the row level, but I want to be able to do it at the cell level. I was able to do it with the...
2
by: markszlazak | last post by:
I'm a relatively slow response of table cells changing their background color with mouseover/our in IE6 (Win 2K) but the response is fine (fast) in Firefox. Why? The code is below. Sorry about the...
2
by: markszlazak | last post by:
Could someone check out the following code and please help me understand the problem and fix it. It seems like some events are not firing when my mouse moves over the table cells to quickly causing...
0
by: spacecadet563 | last post by:
I am trying to change and display the image source of an image control (named image2 )on mouseover of cell event on a gridview(Gridview1) with a SQL datasource. The cell contains image name of image...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.