后台弹出提示信息

来源:互联网 发布:苹果home键软件 编辑:程序博客网 时间:2024/05/19 13:24
1.后台弹出提示信息方法Response.Write("<script type="text/javascript">alert('你所查询的数据不存在!');</script>");//弹出提示信息,但页面空白Page.RegisterClientScriptBlock("tishi", "<script type="text/javascript">alert('你所查询的数据不存在');</script>");//弹出提示信息,但页面空白Page.RegisterStartupScript("tishi", "<script type="text/javascript">alert('你所查询的数据不存在');</script>");//已过期,//弹出提示信息,页面不空白ClientScript.RegisterClientScriptBlock(this.GetType(), "tishi", "<script type="text/javascript">alert('你所查询的数据不存在!');</script>");//弹出提示信息,但页面空白ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type="text/javascript">alert('你所查询的数据不存在!');</script>");//弹出提示信息,页面不空白//在vs2005中 需要引入System.Web.Extensions.dllScriptManager.RegisterClientScriptBlock(this.btnTiShi, typeof(Button), "tishi", "alert('你所查询的数据不存在!');", true);//弹出提示信息,但页面空白ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tishi", "alert('你所查询的数据不存在!');", true);//弹出提示信息,但页面空白,this表示pageScriptManager.RegisterStartupScript(this.btnTiShi, typeof(Button), "tishi", "alert('你所查询的数据不存在!');", true);//弹出提示信息,页面不空白ScriptManager.RegisterStartupScript(Page,typeof(Page), "tishi", "alert('你所查询的数据不存在!');", true);//弹出提示信息,页面不空白ScriptManager.RegisterStartupScript(this, typeof(_Default), "tishi", script, true);//弹出提示信息,页面不空白,this表示page//后台获得confirm返回值,并有选择的执行语句块C#端:protected void Page_Load(object sender, EventArgs e){if (!IsPostBack){this.btnTiShi.Attributes.Add("onclick","tishi()");}}protected void btnTiShi_Click(object sender, EventArgs e){if (this.hidevalue.Value == "1"){Response.Write("success");}else{Response.Write("failue");}}JS端:<script type="text/javascript">function tishi(){if(confirm('你确定要删除吗?')){document.getElementByIdx_x('hidevalue').value='1';//window.location.href=window.location.href;}else{document.getElementByIdx_x('hidevalue').value='0';}}</script>
原创粉丝点击