zoukankan      html  css  js  c++  java
  • .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

  • 相关阅读:
    oracle 监听 添加ip
    重装系统windows
    oracle user pwd
    mybatis
    sum行列合计
    IIS8.5 运行WCF
    exp自动备份在bat中不执行
    oem 重建
    yum install oracle-validated
    MSHflexgrid控件删除选中行
  • 原文地址:https://www.cnblogs.com/unruledboy/p/10302.html
Copyright © 2011-2022 走看看