首頁  >  文章  >  web前端  >  Asp.Net alert彈出提示資訊的幾種方法總結_javascript技巧

Asp.Net alert彈出提示資訊的幾種方法總結_javascript技巧

WBOY
WBOY原創
2016-05-16 17:01:492420瀏覽

1.ClientScript.RegisterStartupScript(GetType(),"message","<script>alert('第一種方式,無白螢幕!');</script>");

2.HttpContext.Current.Response.Write("<script>alert('第二種方式,有白色螢幕!')</script>");

3.public static void Show(System.Web.UI.Page page, string msg)
    {
        page.ClientScript。 'javascript' defer>alert('" msg.ToString() "');");
    }
Show(this, "第三種方式,無白屏,不變形!" );

4.Response.Write("<script>alert('第四種方式,有白屏!')</script>");

5.window.showModalDialog('XXX.aspx', '', 'dialogWidth:429px;dialogHeight:200px;location:no,menubar:no,toolbar:no,status:no');

6.Page.clientscript.registerstartupscript(this.gettype(), "", "<script>window.open('../issue/issueallcomment.aspx');</script>");
即可解決.

7.
使用ajax元件的函數,如下:
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "opennewwindow", "alert('彈出框內容!' );", true);

8.
在頁面的body的最後一行放置一個控件,並在程式碼頁裡給這個控件賦值,如:

label.Text="<script>alert('彈出框內容!); </script> ";

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn