您的位置:首页 > 编程语言 > ASP

asp.net 页面中间弹出提示

2009-03-19 19:44 288 查看
cs类文件中:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
private void doShowEnd(string msg){
if (string.IsNullOrEmpty(msg))
return;
string str = "<div style='z-index:0;left:40%;right:40%;top:20%;padding:5px;position:absolute;text-align:center;width:20%;border:#009900 1px solid;background-color:#f9fff6;'>" +
"<div style='margin:5px'>" + msg + "</div>" +
"<input type='button' value='确定' id='msgShowID' onclick='this.parentNode.parentNode.removeChild(this.parentNode);'/>" +
"</div>";
string script = "document.write(/"" + str + "/");document.close;setTimeout(/"document.getElementById('msgShowID').click();/", 3000);";
Page.ClientScript.RegisterStartupScript(this.GetType(), "msgdiv", script, true);
}
protected void doshow(object sender, EventArgs e)
{
doShowEnd("删除成功");
}
}

页面中:

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="doshow" />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: