日期:2014-05-17 浏览次数:20462 次
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script> <script type="text/javascript"> $(function () { $.ajax({ type: "GET", url: "DisplayData.aspx", data: { key: "Display" }, success: function (data, status) { var json = eval("(" + data + ")"); // alert(json); var html = "<table border='1' cellspacing='1'><tr><td>用户ID</td><td>用户名</td>"; html += "<td>用户密码</td><td>编辑</td><td>删除</td></tr>"; for (var i = 0; i < json.length; i++) { html += "<tr align='center'><td>" + json[i].testID + "</td>" + "<td>" + json[i].testName + "</td>" + "<td>" + json[i].testPassword + "</td>" + "<td class='point' id='Edit' Editid='" + json[i].testID + "'>编辑</td>" + "<td class='point' id='Delete' Deleteid='" + json[i].testID + "'>删除</td>"; } html += "</table>"; $("#divContent").html(html); } }) $("#Delete").bind("click", function () { var result = confirm('确定要删除吗?'); if (result == true) { var keyid = $("#this").attr("Deleteid"); $.ajax({ type: "GET", url: "DisplayData.aspx", data: { key: "Delete", id: keyid }, success: function (data, status) { if (data == true) { alert('删除成功!'); } else { alert('删除失败!'); } } }) } }) $("#BtnInsert").click(function () { //alert($("#Delete").attr("keyid")); $("#InsertDiv").show(); }) }) </script>
function MyBind() { $("#Delete").bind("click", function () { var result = confirm('确定要删除吗?'); if (result == true) { var keyid = $("#this").attr("Deleteid"); $.ajax({ type: "GET", url: "DisplayData.aspx", data: { key: "Delete", id: keyid }, success: function (data, status) { if (data == true) {