写脚本块

有模式的窗口
function GetCustomerInfo(id)
{
    showModalDialog('GetCustomers.aspx?id='+id,window,'help:no;status:no;resizable:yes;dialogWidth:580px;dialogHeight:400px');
  
}
    Public C_strCon As String = ConfigurationSettings.AppSettings("ConnectionString")
    Public ServerDir As String = ConfigurationSettings.AppSettings("ChongYuanDirServer")

    Public strSql As String

    Public Sub MsgBox(ByVal pMsg As String, ByVal oPage As Page)
        Dim strScript As String = "<script language=JavaScript>"
        strScript += "alert('" & pMsg & "');"
        strScript += "</script>"
        If (Not oPage.IsStartupScriptRegistered("clientScript")) Then
            oPage.RegisterStartupScript("clientScript", strScript)
        End If
    End Sub

    Public Sub UrlLocate(ByVal url As String, ByVal oPage As Page)
        Dim strScript As String = "<script language=JavaScript>"
        strScript += "document.location.href='" & url & "';"
        strScript += "</script>"
        If (Not oPage.IsStartupScriptRegistered("clientScript")) Then
            oPage.RegisterStartupScript("clientScript", strScript)
        End If
    End Sub

    Public Sub GoHistory(ByVal sLocation As String, ByVal oPage As Page)
        Dim strScript As String = "<script language=JavaScript>"
        strScript += "window.history.go('" & sLocation.ToString & "');"
        strScript += "</script>"
        If (Not oPage.IsStartupScriptRegistered("clientScript")) Then
            oPage.RegisterStartupScript("clientScript", strScript)
        End If
    End Sub

    Public Function DBNullToString(ByVal DBObj As Object) As String
        If Not IsDBNull(DBObj) Then
            Return Trim(DBObj.ToString)
        Else
            Return ""
        End If
    End Function

    Public Function DBNullToInt(ByVal DBObj As Object) As Integer
        If Not IsDBNull(DBObj) Then
            Return CInt(DBObj)
        Else
            Return 0
        End If
    End Function

    Function TrueLen(ByVal str As String) As Short
        '求一个包含双字节字符的真实长度
        Dim c As Char
        Dim i As Short
        Dim shtLen As Short = 0
        For i = 0 To str.Length - 1
            c = str.Chars(i)
            shtLen += IIf(AscW(c) > 127, 2, 1)
        Next
        TrueLen = shtLen
    End Function

    Public Function GradeList(ByVal BackYears As Short, ByVal ForwardYears As Short) As String()
        Dim i As Short
        Dim Years As Short = BackYears + ForwardYears
        Dim arrGrade(Years) As String
        Dim curYear As Short = Date.Today.Year
        For i = 0 To Years
            arrGrade(i) = Right((curYear - BackYears + i).ToString, 2)
        Next
        Return arrGrade
    End Function

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值