Asp.Net alert彈出提示信息的若干種方法

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

2.HttpContext.Current.Response.Write("<script>alert('第二種方式,有白屏!')</script>");
3.publicstaticvoidShow(System.Web.UI.Pagepage,stringmsg)
{
page.ClientScript.RegisterStartupScript(page.GetType(),"message","<scriptlanguage='javascript'defer>alert('"+msg.ToString()+"');</script>");
}
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>";

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章