VBScript部分我已经编好了 就是不懂javaScript 想马上改到javaScript 

解决方案 »

  1.   

    Function GetProfileString( strPath, strSection, strEntry )
    Dim Fso
    Dim objHandle
    Dim aData
    Dim bFound
    Dim strWork
    Dim aWork
    Dim I
    Set Fso = Server.CreateObject("Scripting.FileSystemObject")
    Set objHandle = Fso.OpenTextFile( strPath, 1 )
    aData = Split( objHandle.ReadAll, vbCrLf )
    objHandle.Close
    Set objHandle = Nothing
    Set Fso = Nothing
    GetProfileString = Empty
    bFound = False
    For I = 0 to Ubound( aData )-1
    if bFound then
    if Left( aData( I ), 1 ) = "[" then
    Exit For
    end if
    strWork = LTrim( aData( I ) )
    if Left( strWork, Len(strEntry)) = strEntry then
    aWork = Split( strWork, "=" )
    if Trim(aWork(0)) = strEntry then
    if Ubound( aWork ) = 1 then
    GetProfileString = Trim( aWork( 1 ) )
    Exit For
    end if
    end if
    end if
    end if
    if aData(I) = "[" & strSection & "]" then
    bFound = True
    end if
    Next
    End Function
      

  2.   

    Function WriteProfileString( strPath, strSection, strEntry, strValue )
    Dim Fso
    Dim objHandle,aData,bFound,strWork,aWork,I,nSection,bReplace
    Set Fso = Server.CreateObject("Scripting.FileSystemObject")
    Set objHandle = Fso.OpenTextFile( strPath, 1 )
    aData = Split( objHandle.ReadAll, vbCrLf )
    objHandle.Close
    Set objHandle = Nothing
    Set Fso = Nothing
    bReplace = False
    bFound = False
    For I = 0 to Ubound( aData )-1
    if bFound then
    if Left( aData( I ), 1 ) = "[" then
    Exit For
    end if
    strWork = LTrim( aData( I ) )
    if Left( strWork, Len(strEntry)) = strEntry then
      aWork = Split( strWork, "=" )
        if Trim(aWork(0)) = strEntry then
          if Ubound( aWork ) = 1 then
            strWork = Trim( aWork( 1 ) )
            aData( I ) = Replace( aData( I ), strWork, strValue )
            strWork = Join( aData, vbCrLf )
            Set objHandle = Fso.OpenTextFile( strPath, 2, True )
            objHandle.Write strWork
            objHandle.Close
            bReplace = True
          Exit For
        end if
      end if
    end if
    end if
    if aData(I) = "[" & strSection & "]" then
    nSection = I
    bFound = True
    end if
    Next
    if not bReplace then
    if bFound then
    aData(nSection) = aData(nSection) & _
    vbCrLf & strEntry & "=" & strValue
    strWork = Join( aData, vbCrLf )
    Set objHandle = Fso.OpenTextFile( strPath, 2, True )
    objHandle.Write strWork
    objHandle.Close
                   else
    aData(Ubound( aData )-1) = aData(Ubound( aData )-1) & _
    vbCrLf & "[" & strSection & "]" & _
    vbCrLf & strEntry & "=" & strValue
    strWork = Join( aData, vbCrLf )
    Set objHandle = Fso.OpenTextFile( strPath, 2, True )
    objHandle.Write strWork
    objHandle.Close
    end if
    end if
    End Function
      

  3.   

    给大家推荐一个JAVASCRIPT站点,http://www.tutejs.cn,来这里可以看到很多JAVASCRIPT。
      

  4.   

    既然已经用VBSCRIPT写好了,为什么还要改呢?
    这两种Script可以同时在页面中使用啊。
    别费那劲了,用VBScript挺好