标签:对话框 key obj nta img 估计 start iss alert
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Default4 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } //插入到文档的末端 protected void Button1_Click(object sender, EventArgs e) { if (!this.Page.ClientScript.IsStartupScriptRegistered("key1")) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "key1", "<script language=javascript>alert(‘" + "ok1" + "‘)</script>"); } } //插入到文档的顶端(实践证明,不论是否采用判断,都会弹出对话框。估计是页面发回服务器后,再发来,脚本就丢失了) protected void Button2_Click(object sender, EventArgs e) { if (!this.Page.ClientScript.IsClientScriptBlockRegistered("key2")) { this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "key2", "<script language=javascript>alert(‘" + "ok2" + "‘)</script>"); } } }
(实践证明,不论是否采用判断,都会弹出对话框。估计是页面发回服务器后,再发来,脚本就丢失了)可能在异步的时候有用
标签:对话框 key obj nta img 估计 start iss alert
原文地址:https://www.cnblogs.com/qqhfeng/p/10340224.html