62,046
社区成员
发帖
与我相关
我的任务
分享
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript">
function postServer(){
var data = "aa";
<%= ClientScript.GetCallbackEventReference(this, "data", "acceptServer",null)%>;
}
function acceptServer(arg){
alert(arg);
}
</script>
</head>
<body>
<form runat="server">
<input id="Text1" type="text" />
<input id="Button1" type="button" value="button" onclick="postServer()" />
<a onclick="postServer()">获取</a>
</form>
</body>
</html>
public partial class Callback : System.Web.UI.Page, ICallbackEventHandler
{
public string str;
protected void Page_Load(object sender, EventArgs e)
{
}
#region ICallbackEventHandler 成员
string ICallbackEventHandler.GetCallbackResult()
{
return str + "csdn";
}
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
str = eventArgument;
}
#endregion
}