xx.aspx <script language="javascript" type="text/javascript">
function pro()
{
var chaName="新的一章";
var chaName = window.prompt("请输入章的名称",chaName);
//alert(chaName);
<%= ClientScript.GetCallbackEventReference(this, "chaName", "addChapter",null)%>;
}
function addChapter(receiveValue)
{
document.getElementById("status").innerHTML=receiveValue;
}
</script>
<img src="images/s_zjz.gif" alt="" onclick="javascrīpt:pro();addChapter();" style="cursor: hand;" />
<span id="status"></span>xx.aspx.cs
private string CallBackValue = string.Empty;
//Ajax增加章
/// <summary>
/// 接收前台输入数据
/// </summary>
/// <param name="getScriptString"></param>
void ICallbackEventHandler.RaiseCallbackEvent(string getScriptString) //用来接收前台JavaScript中传来的字符串变量
{
this.CallBackValue = getScriptString; //将前台变量赋值给服务器内部变量this.CallBackValue
} /// <summary>
/// 返回服务端处理结果
/// </summary>
/// <returns></returns>
string ICallbackEventHandler.GetCallbackResult()
{
string returnValue = "";
returnValue += "<asp:TreeView ID='TreeView1' runat='server' ImageSet='Simple'>";
returnValue += "<ParentNodeStyle Font-Bold='False' />";
returnValue += "<HoverNodeStyle Font-Underline='True' ForeColor='#5555DD' />";
returnValue += " <SelectedNodeStyle Font-Underline='True' HorizontalPadding='0px' VerticalPadding='0px' ForeColor='#5555DD' />";
returnValue += "<NodeStyle Font-Names='Tahoma' Font-Size='10pt' ForeColor='Black' HorizontalPadding='0px' NodeSpacing='0px' VerticalPadding='0px' />";
returnValue += "</asp:TreeView>";
TreeNode node = new TreeNode(CallBackValue);
TreeView1.Nodes.Add(node);
Response.ContentType = ("text/xml;charset=UTF-8");
return returnValue; }-----------------
我想添加章节,可总是不对
function pro()
{
var chaName="新的一章";
var chaName = window.prompt("请输入章的名称",chaName);
//alert(chaName);
<%= ClientScript.GetCallbackEventReference(this, "chaName", "addChapter",null)%>;
}
function addChapter(receiveValue)
{
document.getElementById("status").innerHTML=receiveValue;
}
</script>
<img src="images/s_zjz.gif" alt="" onclick="javascrīpt:pro();addChapter();" style="cursor: hand;" />
<span id="status"></span>xx.aspx.cs
private string CallBackValue = string.Empty;
//Ajax增加章
/// <summary>
/// 接收前台输入数据
/// </summary>
/// <param name="getScriptString"></param>
void ICallbackEventHandler.RaiseCallbackEvent(string getScriptString) //用来接收前台JavaScript中传来的字符串变量
{
this.CallBackValue = getScriptString; //将前台变量赋值给服务器内部变量this.CallBackValue
} /// <summary>
/// 返回服务端处理结果
/// </summary>
/// <returns></returns>
string ICallbackEventHandler.GetCallbackResult()
{
string returnValue = "";
returnValue += "<asp:TreeView ID='TreeView1' runat='server' ImageSet='Simple'>";
returnValue += "<ParentNodeStyle Font-Bold='False' />";
returnValue += "<HoverNodeStyle Font-Underline='True' ForeColor='#5555DD' />";
returnValue += " <SelectedNodeStyle Font-Underline='True' HorizontalPadding='0px' VerticalPadding='0px' ForeColor='#5555DD' />";
returnValue += "<NodeStyle Font-Names='Tahoma' Font-Size='10pt' ForeColor='Black' HorizontalPadding='0px' NodeSpacing='0px' VerticalPadding='0px' />";
returnValue += "</asp:TreeView>";
TreeNode node = new TreeNode(CallBackValue);
TreeView1.Nodes.Add(node);
Response.ContentType = ("text/xml;charset=UTF-8");
return returnValue; }-----------------
我想添加章节,可总是不对
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货