Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get value on click from table using javascript

 
Alex gRin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help get value on click from table using java script

I have a table generated from mysql query I have a code that highlight the row on the mouse click it the JavaScript but I also want to get the value of the cells from the row that is highlighted I tried doing different stuff but I always get an error value undefined.

Here is my code

in the JavaScript function I not only want to get the row highlighted but I also want to get the values of the cell in a row on mouse click



THANKS IN ADVANCE
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first ting for a performance boost, you do not want to check for the body each time in the loop. Instead only grab the rows in the body to start with



If you have multiple tbodies, than you can add a loop there.

To get the values of the cells it would just be something like




Eric>
 
Alex gRin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks your suggestion worked fine but now I am face with different problem this code works fine


and I am trying to send it to another php/html page the problem is the JavaScript is not running everything else works fine
is there a way to do this

here is my ajax function which is on separate file specifically for calling files using ajax



is there a way to use this ajax to send the php function above with JavaScript working

Thanks in advance
and Thanks for all the support this site is providing while I work on this project
I would really appreciate any help I am new to web programming that may be the reason why I have so many questions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic