• .net中js脚本封装函数


    我在工作中封装了几个.net中js脚本封装函数:
     

        Public Shared Sub RunScript(ByRef pgeParenet As System.Web.UI.Page, _
                                    ByVal strScript As String)
            '名称:RunScript
            '功能:封装执行脚本
            '作者:unruledboy
            '创建:2003/8/20
            '修改:2004/2/5
            '参数::
            '      :
            '返回:成功,True,反之,False
            '说明:
            Dim o_strScript As String = "<script language=javascript>"

            o_strScript = o_strScript & strScript & " </script>"
            pgeParenet.RegisterStartupScript("Script", o_strScript)

        End Sub

        Public Shared Sub ShowMessage(ByRef pgeParenet As System.Web.UI.Page, _
                                      ByVal strMessage As String, _
                                      Optional ByVal scrScript As String = "")
            '名称:ShowMessage
            '功能:封装显示提示
            '作者:unruledboy
            '创建:2003/8/20
            '修改:2004/2/5
            '参数::
            '      :
            '返回:成功,True,反之,False
            '说明:
            Dim o_strErrMessage As String = "<script language=javascript>alert(' "

            o_strErrMessage &= strMessage & "');"

            If scrScript <> "" Then
                o_strErrMessage &= scrScript
            End If
            o_strErrMessage &= " </script>"

            pgeParenet.RegisterStartupScript("Message", o_strErrMessage)

        End Sub

        Public Shared Sub ShowMessageAndRedirect(ByRef pgeParenet As System.Web.UI.Page, _
                                                 ByVal strMessage As String, _
                                                 ByVal strScript As String)
            '名称:ShowMessageAndRedirect
            '功能:封装显示提示
            '作者:unruledboy
            '创建:2003/8/20
            '修改:2004/2/5
            '参数::
            '      :
            '返回:成功,True,反之,False
            '说明:
            Dim o_strErrMessage As String = "<script language=javascript>alert(' "

            o_strErrMessage &= strMessage & "');this.location.replace('"

            o_strErrMessage &= strScript

            o_strErrMessage &= "'); </script>"

            pgeParenet.RegisterStartupScript("Message", o_strErrMessage)

        End Sub

  • 相关阅读:
    HCTF2018-admin
    SUCTF 2019-EasySQL
    BUUCTF-WEB-easy_tornado
    黑客攻防技术宝典web实战篇:攻击数据存储区习题
    可持久化数据结构·主席树(静态)
    Luogu P2661 [NOIP2015] 信息传递
    Luogu P2700 逐个击破
    Luogu P4779 【模板】单源最短路径(标准版)(Dijkstra+堆优化模板)
    Luogu P1962 斐波那契数列(矩阵乘法模板)
    Luogu P3366 【模板】最小生成树
  • 原文地址:https://www.cnblogs.com/unruledboy/p/10302.html
Copyright © 2020-2023  润新知