标签:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="gb2312"> 5 <meta name="author" content="http://www.yuanquanshuqian.com/" /> 6 <title>源泉书签</title> 7 8 <script> 9 //删除行;(obj代表连接对象) 10 function deleteRow(obj){ 11 //获取tr对象; 12 var mytd = obj.parentNode; 13 alert(mytd.innerHTML); 14 } 15 </script> 16 17 </head> 18 <body> 19 <table id="mylist"> 20 <tr> 21 <td style=‘border:solid 1pt;WIDTH:344px;HEIGHT:21px‘ bgcolor=transparent>2012-12-02 09:45:01 <a href="#" onclick="deleteRow(this)">编辑</a> </td> 22 </tr> 23 </table> 24 25 </body>
主要通过this来获取,配合parentNode方法
标签:
原文地址:http://www.cnblogs.com/souroot/p/4297706.html