pass a cell value

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

pass a cell value

Post by shiranwas »

hi,

I am having a page with a table which is created dynamically. I have 2 problems
one is how to identify which row the user clicks and send the cell value to a new page

thanks in advance
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

Code: Select all

<a href='page.php?value=<?php echo $value; ?>'>text</a>
Or - if you want to be sure user can't change the value - send just the row id and do another query on the second page.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Code: Select all

<script language="javascript">
function changeText(tdObj){
  window.location="mypage.php?cell="+tdObj.id;
}
</script>
<table>
  <tr>
    <td id="row_1_cell_1" onClick="changeText(this)">text</td>
    <td id="row_1_cell_2" onClick="changeText(this)">text</td>
  </tr>
</table>
note: this is untested, but should work in principle.

edit: moved to clientside.
Post Reply