首页 新闻 会员 周边 捐助

为什么加onserverclick="btnCreate_ServerClick"事件就不能正确执行

0
悬赏园豆:5 [待解决问题]

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="动态添加删除.aspx.cs" Inherits="JavaScript练习.动态添加删除" %>

<!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 loadData() {
            var table = document.getElementById("table");
            var data = { "字段0": "<input type='checkbox' name='checkbox'/>", "字段一": "<input type='text' id='txtItem1' ruant='server'/>", "字段2": "<input type='text' id='txtItem2' ruant='server'/>", "字段3": "<input type='text' id='OrderNum' ruant='server'/>" };
            var tr = document.createElement("tr");
            for (var key in data) {
                var value = data[key];

                var td1 = document.createElement("td");
                td1.innerText = key;
                tr.appendChild(td1);

                var td2 = document.createElement("td");
                td2.innerHTML = value;
                tr.appendChild(td2);
                table.tBodies[0].appendChild(tr);

            }
        }


        function loadDelete() {
            var checkAll = document.getElementsByName("checkbox");

            for (var i = 0; i < checkAll.length; i++) {
                if (checkAll[i].checked == true) {

                    var table = document.getElementById("table");
                    table.tBodies[0].removeChild(table.rows[i])

                }
            }
        }


    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table id="table">
            <tbody>
            </tbody>
        </table>
     
         <input type="button" value="动态增加" onclick="loadData()" id="btnCreate" runat="server"/>
        <input type="button" value="动态删除" onclick="loadDelete()" />
      
    </div>
    </form>
</body>
</html>

我的目的是动态增加删除行,并在动态增加按钮写onserverclick="btnCreate_ServerClick1",为什么加了onserverclick="btnCreate_ServerClick1"就不能增加行了

谁能帮我解决谢谢

杀  手的主页 杀 手 | 菜鸟二级 | 园豆:213
提问于:2011-06-06 21:11
< >
分享
所有回答(1)
0

客户端动态生成的空间,服务器端哪里知道啊。

Kain | 园豆:445 (菜鸟二级) | 2011-06-07 09:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册