<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery-1.5.min.js" type="text/javascript"></script>
<script>
$(function(){
$(".edit").live("click",function(){
 var tr = $(this).closest("tr");
        var p = tr.data("obj");
        $("#Title").val(p.Title);
        $("#Content").val(p.Content);
        $("#AddTime").val(p.AddTime);
        $("#Add_Info").val("修改");

})
})
</script>
<title>无标题文档</title>
</head><body><table style="width: 836px">
             <tr>
                <th>标题</th>
                <th>内容</th>
                <th>添加时间</th>
             </tr>
        
             <tr>
               <td><a href="ShowPage.aspx?128">13</a></td>
               <td>123123</td>
               <td>123456</td>
               <td><a href="javascript:void(0)" class="edit">编辑</a> <a href="javascript:void(0)" class="delete">删除</a></td>
             </tr>
    </table> <table>
        <tr>
            <td>标题</td>
            <td><input type="text" id="Title" /></td>
        </tr>
        <tr>
            <td>内容</td>
            <td><input type="text" id="Content" /></td>
        </tr>
        <tr>
            <td>添加时间</td>
            <td><input type="text" id="AddTime" /></td>
        </tr>
        <tr>
            <td colspan="2"><input type="button" value="添加" id="Add_Info" /><input type="button" value = "提交"/></td>
        </tr>
    </table></body>
</body>
</html>

解决方案 »

  1.   


    $(function(){
        $(".edit").live("click",function(){
            var tr = $(this).closest("tr");
            var p=   tr.find("td");
            $("#Title").val(p.eq(0).text());
            $("#Content").val(p.eq(1).text());
            $("#AddTime").val(p.eq(2).text());
            $("#Add_Info").val("修改");
        })
    })改了下 能用 。
      

  2.   


    $("#Add_Info[value='修改']").live("click",function(){//Add_Info value的click事件 
    //you code 
     })也就是取值赋值了 。主要是弄个东西保存触发'编辑'的行 在集合中的下标 。就这么多了 。
      

  3.   


     var index  = tr.parent().children().index( $(this).parent().parent());这样能获得是哪个行 。$(this)是个'编辑'a标签 。
      

  4.   


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="jquery-1.4.4.js" type="text/javascript"></script>
    <script>
    $(function(){
    $(".edit").live("click",function(){
    var tr = $(this).parents("tr");
      var p = tr.find("td");
      $("#Title").val(p.eq(0).text());
      $("#Content").val(p.eq(1).text());
      $("#AddTime").val(p.eq(2).text());
      $("#Add_Info").val("修改");});$("#Add_Info").click(function(){
       var title=$("#Title").val();
       var content=$("#Content").val();
       var addTime=$("#AddTime").val();
       var target=$(this).parents("table").prev().find("tr:eq(1)");
       target.find("td").eq(0).text(title);
       target.find("td").eq(1).text(content);
       target.find("td").eq(2).text(addTime);
    });})
    </script>
    <title>无标题文档</title>
    </head><body><table style="width: 836px">
      <tr>
      <th>标题</th>
      <th>内容</th>
      <th>添加时间</th>
      </tr>
        
      <tr>
      <td><a href="ShowPage.aspx?128">13</a></td>
      <td>123123</td>
      <td>123456</td>
      <td><a href="javascript:void(0)" class="edit">编辑</a> <a href="javascript:void(0)" class="delete">删除</a></td>
      </tr>
      </table> <table>
      <tr>
      <td>标题</td>
      <td><input type="text" id="Title" /></td>
      </tr>
      <tr>
      <td>内容</td>
      <td><input type="text" id="Content" /></td>
      </tr>
      <tr>
      <td>添加时间</td>
      <td><input type="text" id="AddTime" /></td>
      </tr>
      <tr>
      <td colspan="2"><input type="button" value="添加" id="Add_Info" /><input type="button" value = "提交"/></td>
      </tr>
      </table></body>
    </body>
    </html>