大家好,我是新人,请多关照
一般在搜索时候,搜索引擎会分出好多页面,我要让webbrowser自动的抓取下一页面内容:Private Sub Command1_Click()
Dim idoc As HTMLDocument
Set idoc = WebBrowser1.Document
Dim scan As Integer
For scan = 0 To webbrowser1.document.links.length-1
    If InStr(webbrowser1.document.links(i).innertext, "下一页" > 0 Then
        WebBrowser1.Navigate2 webbrowser1.document.links(i)
                   End If
Next    End Sub
    现在问题是这样 有这样一个页面,他不出现任何links.innertext 如'next page" 下页“等等! 他的页面代码如下:<A href="javascript:page('10')">
<img src=/PageControl_images/next_blue.gif height=13 border=0></A>
这是第2页 如果是20就是第3页javascript 部分的page function 代码为:function page(inStr){
with(hidden_form){
offset.value = inStr;
submit();form 提交部分代码为:<form name=hidden_form method=post action="list.jsp">
<input type=hidden name="keyword" value="null">
<input type=hidden name="type" value="117101">
<input type=hidden name="province" value="null">
<input type=hidden name="city" value="null">
<input type="hidden" name="ltype" value="null">
<input type="hidden" name="mtype" value="null">
<input type=hidden name="offset" value="">
</form>我诚挚请教各位帮忙看怎么样能继续下个页面!我先是判断javascript部分:Dim idoc As HTMLDocument
Set idoc = WebBrowser1.Document
Dim oo As Object
Set oo = idoc.All.tags("A")
Dim scan As Integer
For scan = 0 To oo.length - 1
    If InStr(oo.Item(scan).href, "page('10')") > 0 Then
        WebBrowser1.Navigate2 oo.Item(scan).href
                   End If
Next这样可以,但是还是只到第2页面Dim idoc As HTMLDocument
Set idoc = WebBrowser1.Document
Dim oo As Object
Set oo = idoc.All.tags("img")
Dim scan As Integer
For scan = 0 To oo.length - 1
    If InStr(oo.Item(scan).href, "next"> 0 Then
        ?????
                   End If
Next以上部分是我找到img 里有next的gif图片,实际上点这个就可以继续,可是我不知道img这个object collection有没有submit or click 等event 尝试很多也不行请大家帮忙

解决方案 »

  1.   

    jsp接收字符串是不分辨get或者post的。你可以直接把页面参数用get方式传过去。其中instr就是第几页。
      

  2.   

    谢谢您了!我最好找到笨方法 :<A href="javascript:page('10')">
    <img src=/PageControl_images/next_blue.gif height=13 border=0></A>img link next_blue.gif 就是下一页 我不管instr 到底是第几页 我直接用
    If InStr(oo.Item(scan).href, "next"> 0 Then
    oo.item(scan).href.click这样就可以了!
      

  3.   

    请问楼主:那个oo.Item(scan).href中的"scan"是什么东东?请教!
      

  4.   

    这里是正确的代码 oo 是所有img 的集合Dim idoc As HTMLDocument
    Set idoc = WebBrowser1.Document
    Dim oo As Object
    Set oo = idoc.All.tags("IMG")Dim scan As Integer
    For scan = 0 To oo.length - 1
       If InStr(oo.Item(scan).href, "next"> 0 Then
    oo.item(scan).href.click
                               End If
    Next