我想提取http://kaijiang.zhcw.com/zhcw/html/3d/list_1.html中下面的总页码及总记录条数,请问怎么提取,请高手指点,最好有源码.
即里面的

解决方案 »

  1.   

    这个是vb的吗 好像的bs开发
      

  2.   

    如过找到了<p class="pg"> 共<strong>是不是就找到 楼主的答案了?
      

  3.   

    Private Sub Command1_Click()
        ss = WebBrowser1.Document.body.innerText '得到所有文字
        aa = "附加玩法共" '找出要分离的文字前面有标志性的文字
        bb = InStr(1, ss, aa) '确定位置
        cc = Mid(ss, bb + Len(aa), 12)  '取出“附加玩法共”后面的东西
        dd = InStr(1, cc, " 页 /") '确定“ 页 /”位置
        ee = Mid(cc, 1, dd) '取出“ 页 /”前面的东西
        ff = Mid(cc, dd + 4, Len(cc)) '取出“ 页 /”后面的东西
        Me.Caption = ee & "  " & ff '显示在窗口的标题栏
    End SubPrivate Sub Form_Load()
        Label1.Caption = ""
        Label1.AutoSize = True '自动调整大小
        WebBrowser1.Width = 0 '为了不让其显示出来,设置宽度为0
        WebBrowser1.Height = 0 ''为了不让其显示出来,设置高度为0
        WebBrowser1.Navigate "http://kaijiang.zhcw.com/zhcw/html/3d/list_1.html"
        Timer1.Interval = 100 '每秒更新一次
        Timer1.Enabled = True '启动定时器
    End Sub
      

  4.   

    创建一个新窗体。然后
    在“项目”菜单上单击“引用”。
    双击“Microsoft VBScript Regular Expressions 5.5”,然后单击“确定”。
    窗体上放一个按钮。然后复制如下代码就可以看到效果。
    Private Sub Command1_Click()
        Dim html As String
        html = GetHtml("http://kaijiang.zhcw.com/zhcw/html/3d/list_1.html")
        Dim reg As RegExp
        Set reg = New RegExp
        reg.Pattern = "共\D+(\d+)\D+(\d+)"
        Dim m As MatchCollection
        Set m = reg.Execute(html)
        MsgBox "页码:" & m(0).SubMatches(0) & vbCrLf & "记录:" + m(0).SubMatches(1)
    End SubPublic Function GetHtml(ByVal url As String) As String
        If InStr(url, "http://") <> 1 Then url = "http://" + url
        Dim xmlHTTP1
        Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP")
        xmlHTTP1.Open "get", url, True
        xmlHTTP1.send
        While xmlHTTP1.readyState <> 4
            DoEvents
        Wend
        GetHtml = xmlHTTP1.responseText
    End Function