ajax中弹出提示框

来源:互联网 发布:工时记录软件 编辑:程序博客网 时间:2024/05/21 06:28

转自:http://blog.csdn.net/ptyzhu/article/details/7893625

弹出提示框的几种基本方式:

Response.Write("<script>alert('成功!');window.location.href='task.aspx';</script>");

Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "<script>alert('成功!');</script>");


Page.RegisterStartupScript("test", "<script>alert('成功!');</script>");


在ajax中上述方式将失效,解决办法如下:

ScriptManager.RegisterStartupScript(this,this.GetType(),"test","alert('成功!');",true);

ps:最后一个参数的bool值表示是否在前一个参数script中加<script></script>标签,当为false时需要手动加该标签


原创粉丝点击