本帖最后由 希涯 于 2012-1-18 03:50 AM 编辑

  1. <tr style="background-color: #F0F0F0; ">
  2. <td class="leavehistory" style="width: 6%; padding: 7px;">1</td>
  3. <td id="leaveID" class="leavehistory" style="width: 9%;">LE000001</td>
  4. <td class="leavehistory" style="width: 12%;">2012-12-12 00:00:00.0</td>
  5. <td class="leavehistory" style="width: 10%;">2 days</td>
  6. <td class="leavehistory" style="width: 15%;">12122011 - 13122011</td>
  7. <td class="leavehistory" style="width: 15%;">Sick</td>
  8. <td style="width: 30%;"><select>
  9. <option value="0">Pending</option>
  10. <option value="1">Cancel</option>
  11. </select> <input class="button"  type="button" name="bttn" onClick="cancelSub();"value="View"/><input class="button"  type="button" name="bttnDelete" onClick="cancelSub();"value="Change"/></td>
  12. </tr>
  13.                     
  14. <tr style="background-color: #F0F0F0; ">
  15. <td class="leavehistory" style="width: 6%; padding: 7px;">2</td>
  16. <td id="leaveID" class="leavehistory" style="width: 9%;">LE000002</td>
  17. <td class="leavehistory" style="width: 12%;">2012-01-17 19:31:18.0</td>
  18. <td class="leavehistory" style="width: 10%;">2 days</td>
  19. <td class="leavehistory" style="width: 15%;">18/01/2012 - 19/01/2012</td>
  20. <td class="leavehistory" style="width: 15%;">Sick</td>
  21. <td style="width: 30%;"><select>
  22. <option value="0">Pending</option>
  23. <option value="1">Cancel</option>
  24. </select> <input class="button"  type="button" name="bttn" onClick="cancelSub();"value="View"/><input class="button"  type="button" name="bttnDelete" onClick="cancelSub();"value="Change"/></td>
  25. </tr>
复制代码
上面是两个row的data 各自都有View 和 Change button

比方说 我click LE000001 那个row的change button 我要用javascript拿到 LE000001 这个value

如果我click LE000002那个row的change button 我就会拿到 LE000002 这个value , 以此类推

这些data是我从database retrieve出来的 所以可能会有很多个row

我要做的当我按change button , database里的record ,status 就会从pending 改去 cancel ,所以我要拿到LE000001才能update去database

请问有没有什么办法?