首页上一页 1 下一页尾页 1 条记录 1/1页
onclick= loaddata() 缺少对象
发表在ASP.NET图书答疑
2012-08-12
是否精华
是
否
版块置顶:
是
否
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="tablelinks"></table>
<input type="button" value="加载数据" onclick="loaddata()" />
</div>
</form>
<script type ="text/javascript">
function loaddata(){
// e.preventDefault();
$.post("shuju.ashx?id=2",{"ming":ming});
// function loaddata(){
var data ={ming:ming};
var tablelinks=document.getElementById("tablelinks");
for (var key in data ){
var value=data [key ];
var tr =tablelinks.insertRow(-1);
var td1=tr.insertCell(-1);
td1.innerText=key ;
var td2=tr.insertCell(-1);
td2.innerHTML="<a herf='"+value +"'>"+value +"</a>"
};
// }
}
</script>
</body>
</html>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="tablelinks"></table>
<input type="button" value="加载数据" onclick="loaddata()" />
</div>
</form>
<script type ="text/javascript">
function loaddata(){
// e.preventDefault();
$.post("shuju.ashx?id=2",{"ming":ming});
// function loaddata(){
var data ={ming:ming};
var tablelinks=document.getElementById("tablelinks");
for (var key in data ){
var value=data [key ];
var tr =tablelinks.insertRow(-1);
var td1=tr.insertCell(-1);
td1.innerText=key ;
var td2=tr.insertCell(-1);
td2.innerHTML="<a herf='"+value +"'>"+value +"</a>"
};
// }
}
</script>
</body>
</html>