Inet1.Execute的第三个参数是提交一个FromData,假如ASP网页有多个条件的数据要提交,我该怎么把它们连起呢?比如:<form name="xxx" action="xxx.asp" method="post" target="_blank"> 
                        
          <font size="2">请输入年份</font><input type="text" name="Year" size="16">        
          &nbsp;  
          <font size="2"> 请输入月份</font><input type="text" name="Moon" size="16">      这里的Year和Moon两者的数据都要提交才能正常搜索出结果,我该怎么写呢?strFormData="Year=2004"然后后面我不知道怎么将月份跟上面这句代码连起来提交

解决方案 »

  1.   

    strFormData="Year=2004&month=2"
    基本的写法,但是记住如果参数值里面有中文的话,要url编码的,参考下面~~还要说明一个问题,如果是中文名字的话,要登陆的话,需要进行url编码,注意这里了吗??
    '设置这个Content-Type很重要
    objhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"编码的函数如下 :Public Function URLEncode(ByVal strInput As String) As String
         Dim strOutput As String
         Dim intAscii As Integer
         Dim i As Integer
         
         
         For i = 1 To Len(strInput)
         intAscii = Asc(Mid(strInput, i, 1))
         If ((intAscii < 58) And (intAscii > 47)) Or _
         ((intAscii < 91) And (intAscii > 64)) Or _
         ((intAscii < 123) And (intAscii > 96)) Then
         strOutput = strOutput & Chr$(intAscii)
         Else
         strOutput = strOutput & _
         IIf(intAscii < 16, "%0", "%") & _
         Trim$(Hex$(intAscii))
         End If
         Next
         URLEncode = strOutput
    End Function以下为使用:
    strFormData="Year=" & URLEncode("年份") & "&month="" & URLEncode("月份")