晕了
onclick='deleteData(this);'
一直错,看半天才发现
function deleterow(obj) 

    var tr=obj.parentNode.parentNode; 
    var tbody=tr.parentNode;     
}
居然方法名不一样

解决方案 »

  1.   

    <table>
    <tr> 
       <td>11</td>
       <td>22</td>
       <td>33</td>
       <td>44</td>
       <td>55</td>
       <td>66</td>
       <td><a href="javascript:Goto();" onclick='edit(this);'>修改</a></td> 
       <td><a href="javascript:goto2();" onclick='deleterow(this);'>删除</a></td> 
    </tr>
    <tr> 
       <td>aa</td>
       <td>bb</td>
       <td>cc</td>
       <td>dd</td>
       <td>ee</td>
       <td>ff</td>
       <td><a href="javascript:Goto();" onclick='edit(this);'>修改</a></td> 
       <td><a href="javascript:goto2();" onclick='deleterow(this);'>删除</a></td> 
    </tr> 
    </table>
    <span id="TextBox1">1</span>
    <span id="TextBox2">2</span>
    <span id="TextBox3">3</span>
    <span id="TextBox4">4</span><script> 
    function Goto()
    {} function goto2()
    {} function edit(obj) 

        var tr=obj.parentNode.parentNode; 
        document.getElementById("TextBox1").innerText=tr.cells[2].innerText; 
        document.getElementById("TextBox2").innerText=tr.cells[3].innerText; 
        document.getElementById("TextBox3").innerText=tr.cells[5].innerText; 
        document.getElementById("TextBox4").innerText=tr.cells[4].innerText; 

    function deleterow(obj) 
    {
        var tr=obj.parentNode.parentNode; 
        var tbody=tr.parentNode; 
        tbody.removeChild(tr); 

    </script>
      

  2.   

    VS2005测了一下问题也没有呀
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="deleteedit.aspx.cs" Inherits="deleteedit" %><!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 runat="server">
        <title>无标题页</title>
        <script type="text/javascript">  
        function Goto() 
        {}      function goto2() 
        {}      function edit(obj)  
        {  
            var tr=obj.parentNode.parentNode;  
            document.getElementById("TextBox1").innerText=tr.cells[2].innerText;  
            document.getElementById("TextBox2").innerText=tr.cells[3].innerText;  
            document.getElementById("TextBox3").innerText=tr.cells[5].innerText;  
            document.getElementById("TextBox4").innerText=tr.cells[4].innerText;  
        }  
        function deleterow(obj)  
        { 
            var tr=obj.parentNode.parentNode;  
            var tbody=tr.parentNode;  
            tbody.removeChild(tr);  
        }  
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <table>
                <tr>
                    <td>
                        11
                    </td>
                    <td>
                        22
                    </td>
                    <td>
                        33
                    </td>
                    <td>
                        44
                    </td>
                    <td>
                        55
                    </td>
                    <td>
                        66
                    </td>
                    <td>
                        <a href="javascript:Goto();" onclick='edit(this);'>修改 </a>
                    </td>
                    <td>
                        <a href="javascript:goto2();" onclick='deleterow(this);'>删除 </a>
                    </td>
                </tr>
                <tr>
                    <td>
                        aa
                    </td>
                    <td>
                        bb
                    </td>
                    <td>
                        cc
                    </td>
                    <td>
                        dd
                    </td>
                    <td>
                        ee
                    </td>
                    <td>
                        ff
                    </td>
                    <td>
                        <a href="javascript:Goto();" onclick='edit(this);'>修改 </a>
                    </td>
                    <td>
                        <a href="javascript:goto2();" onclick='deleterow(this);'>删除 </a>
                    </td>
                </tr>
            </table>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
            <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        </form>
    </body>
    </html>
      

  3.   

    谢谢了。kong521。我现在用另一个方法来获取table数据了。。还是谢谢你的解答。。