注册alert()脚本

一.RegisterClientScriptBlock   三种用法    
string strJS = "";
        1  .  Page.RegisterClientScriptBlock("ajs", strJS);
         2 .Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ajs", strJS);
           3. System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.LinkButtonCreateKelkoo, this.LinkButtonCreateKelkoo.GetType(), "ajs", strJS, true);


   二. Response.Write("");

三.

 public void alert(string msg, string key)
    {

        ClientScriptManager csm = Page.ClientScript;
        Type cstype = this.GetType();
        msg = msg.Replace("\"", "\'");
        string script = "";
        csm.RegisterStartupScript(cstype, key, script);
    }


转载于:https://www.cnblogs.com/newr2006/archive/2008/05/08/1188320.html

你可能感兴趣的:(注册alert()脚本)