zoukankan      html  css  js  c++  java
  • 在后台代码里写 JS语句.

    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Success!')", true);//alert('Success!'): 不用加:<script>...</script>.


    之所以没用Page.ClientScript.RegisterClientScriptBlock而用 Page.ClientScript.RegisterStartupScript是因为RegisterStartupScript 把script放置在ASP.NET page的底部,而RegisterClientScriptBlock把script放置在ASP.NET page的顶部,用RegisterClientScriptBlock会报错,javascript函数找不到对象.


    如果用:Response.Write("<script type='text/javascript'>alert('Success !');");会破坏页面的结构! 如果可以这样用: 把当前页面链接到一个新的页面.或者重新请求此页面.
  • 相关阅读:
    MVC ActionResult JsonResult
    xml文件
    使用socket实现聊天功能
    使用多线程完成Socket
    Socket编程
    U1总结
    多线程
    IO
    单例模式
    日期
  • 原文地址:https://www.cnblogs.com/MySpace/p/1599668.html
Copyright © 2011-2022 走看看