473,385 Members | 1,461 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,385 software developers and data experts.

How can I Get the cell values when it is clicked

Hello..please help with my problem since Im new in using
HTML and javascript.

I have this table that has rows and columns.
Hello..please help me with my problem since Im new in using
HTML and javascript.

I have this table that has rows and columns.
When i click the value of the cell, it will return
the values of the cells of the same row.

Example
Expand|Select|Wrap|Line Numbers
  1. <TABLE>
  2.  <TR>
  3.   <TD>xyz</TD>
  4.   <TD>xxx</TD>
  5.  </TR>
  6.  <TR>
  7.   <TD>abc</TD>
  8.   <TD>aaa</TD>
  9.  </TR>
  10. </TABLE>
  11.  
So if I click cell with xyz value, it should return xyz and xxx values.

Im thinking of using onClick in TD tag then get the values as arguments
for the function.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <TD onClick="GetVal(this);">xyz</TD>
  3.  
is this possible?

how can i manipulate the values sent to the function?
Oct 26 '10 #1
1 1662
Dormilich
8,658 Expert Mod 8TB
when you execute the function, you don’t get both values as parameters, but you can access them inside the function.

it’s probably easier to attach the handler to the table row.
Expand|Select|Wrap|Line Numbers
  1. // W3C
  2. <tr onclick="alert(this.textContent)">
Oct 26 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Scott | last post by:
In the result of a SELECT statement, how can you change cell values from NULL to BLANK? The following does NOT do it: SET fieldname = ' ' WHERE fieldname IS NULL Also, for colums with a DATE...
12
by: adrianca | last post by:
Hi All, If have a sql table with 2 columns and 2 rows with values ,]. Using t-SQL with "for xml" How can i create a xml where the cell values (not column names) appear as elements? eg:...
1
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
2
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title:...
2
by: Rob Roberts | last post by:
Is there any way to prevent a ButtonField in a GridView from doing a postback when clicked? I want to use my own onclick handler to call window.open('SomePage.aspx') to display a page in a new...
1
by: jeganwaran | last post by:
retrieve cell values from the grid view using code
0
by: RKT | last post by:
I have a DataGridView bound to an MS Access table. This is a single- user application. When the User is adding or editing a row, the User may click on a Control elsewhere. That Control has context...
0
by: xprimus | last post by:
Can anyone help me with this, I have a linked image in a tale cell and whenever I click on the image it expands, not only that I have to click on it again to get the link to go. These are the...
1
by: silentbuddha | last post by:
Hi, I am currently having some difficulties with this sunroutine that I created. My 2 dimensional array is empty. - This code is within my UserForm1 - this sub is suppose to first select the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.