zoukankan      html  css  js  c++  java
  • 网页弹出提示框的几种方法.


    1. 在js里面 使用 alert("您的消息")

    2. 在后台代码里面输出js脚本
       button1.Attributes.Add("onclick", "return confirm('确定删除吗?');");

    3. 在后台代码里面:

        Response.Write("<script language=javascript>window.alert('" + ls_ts+ "');</script>"); //显示提示框

    4. Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript>window.alert('ff');</script>");


    如果页面中使用了Ajax ,则上述代码即使执行也无效果。应对这种情况我们通常采用:
    ScriptManager.RegisterStartupScript(this.Button1, this.GetType(), "alertScript", "window.alert('ff')", true);
    或者
    ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "alertScript", "window.alert('ff')", true);
    其中第一个参数为要注册脚本的控件ID,试了一下,只要是本页面的就行。
    第二个参数为注册脚本控件类型,是控件还是this的GetType()都可以,typeOf(string)也没问题.
    第三个脚本函数的名字,随便起。
    第四个是脚本内容。
    第五个是标明是否再添加脚本标签,如果第四个参数里包含了<script></script>标签,此处则为false,否则为true。


      

    5.  //如果 页面上使用了 UpdatePanel

      ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "click", "alert('yyyyy')", true);

       注解: message 是您要弹出的信息

  • 相关阅读:
    手势识别 ios
    无题
    核心动画笔记
    Quartz2D的学习2
    Quartz2D的学习1
    NSURLsessionTask
    NSURLSession
    POST请求的两种方式
    网络第一天
    NSThread
  • 原文地址:https://www.cnblogs.com/zhwl/p/1965705.html
Copyright © 2011-2022 走看看