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

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

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>");
java

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

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

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

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

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

相關文章
相關標籤/搜索