kooyee ‘s blog

          開(kāi)源軟件, 眾人努力的結(jié)晶, 全人類(lèi)的共同財(cái)富
          posts - 103, comments - 55, trackbacks - 0, articles - 66
             :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
          '得到當(dāng)前browser的頁(yè)面字體內(nèi)容
          Public Function getWebContent(browser As WebBrowser) As String
              
          Dim doc As Object
              
          Dim i As Object
              
          Dim strHtml As String
              
              
          Set doc = browser.Document
              
          For Each i In doc.All
                  strHtml 
          = strHtml & Chr(13& i.innerText
              
          Next
              getWebContent 
          = strHtml
          End Function
          上面這個(gè)函數(shù)可以得到browser中所有文字信息.

          '得到當(dāng)前browser的頁(yè)面Html內(nèi)容
          Public Function getWebHtml(browser As WebBrowser) As String
              
          Dim doc As Object
              
          Dim i As Object
              
          Dim strHtml As String
              
              
          Set doc = browser.Document
              
          For Each i In doc.All
                  strHtml 
          = strHtml & Chr(13& i.innerHtml
              
          Next
              getWebHtml 
          = strHtml
          End Function
           上面這個(gè)函數(shù)可以得到browser頁(yè)面的HTML代碼.

          評(píng)論

          # re: VB使用WebBrowser讀取網(wǎng)頁(yè)內(nèi)容  回復(fù)  更多評(píng)論   

          2008-10-16 21:18 by work_man
          請(qǐng)問(wèn),如何調(diào)用呢?

          # re: VB使用WebBrowser讀取網(wǎng)頁(yè)內(nèi)容  回復(fù)  更多評(píng)論   

          2008-10-18 21:24 by kooyee
          看看這段代碼

          Dim vDoc, vTag

          Dim i As Integer

          Set vDoc = WebBrowser1.Document

          For i = 0 To vDoc.All.Length - 1 '檢測(cè)所有標(biāo)簽

          If UCase(vDoc.All(i).innerText) = "INPUT" Then '找到input標(biāo)簽

          Set vTag = vDoc.All(i)

          # re: VB使用WebBrowser讀取網(wǎng)頁(yè)內(nèi)容  回復(fù)  更多評(píng)論   

          2008-11-24 20:13 by 肖子詳
          Private Sub Command1_Click()
          WebBrowser1.Navigate "http://www.baidu.com"
          End Sub

          Private Sub Command2_Click()
          Dim vDoc, vTag

          Dim i As Integer

          Set vDoc = WebBrowser1.Document

          For i = 0 To vDoc.All.Length - 1 '檢測(cè)所有標(biāo)簽

          If UCase(vDoc.All(i).innerText) = "INPUT" Then '找到input標(biāo)簽

          Set vTag = vDoc.All(i)
          End If
          Next
          Text1.Text = vTag

          End Sub


          還是不可以?上面是我做的我想把讀到的內(nèi)容存到TEXT1.TEXT中?

          # re: VB使用WebBrowser讀取網(wǎng)頁(yè)內(nèi)容  回復(fù)  更多評(píng)論   

          2008-11-24 20:34 by 肖子詳
          我試過(guò)了可以讀到網(wǎng)頁(yè)里的文字信息,TKS

          但讀的HTML代碼.會(huì)亂碼.

          # re: VB使用WebBrowser讀取網(wǎng)頁(yè)內(nèi)容[未登錄](méi)  回復(fù)  更多評(píng)論   

          2008-11-26 01:14 by kooyee
          是不是不支持unicode?

          # re: VB使用WebBrowser讀取網(wǎng)頁(yè)內(nèi)容  回復(fù)  更多評(píng)論   

          2010-01-23 11:25 by webyoung
          Click a arrow on a google web site automaticly.

          --------------------------------------------------------------------------------

          I want to write a code to click automaticly the "next arrow" or the "last arrow" on the bottom of the following web site.

          http://www.google.com/finance/stocks...rt=&sortOrder=

          I know the htmlText for these two arrow is as following:


          HTML Code:
          <DIV class=tpbd closure_hashCode_f042o7="42">
          <DIV class=SP_arrow_next></DIV></DIV>
          <DIV class=tpsd>21 - 40 of 2658 rows</DIV>
          <DIV class=tpbd closure_hashCode_f042o7="41">
          <DIV class=SP_arrow_previous></DIV></DIV>
          <DIV class=tpbd closure_hashCode_f042o7="40">
          <DIV class=SP_arrow_first></DIV></DIV><SELECT class=tpdd
          closure_hashCode_f042o7="39"><OPTION value=10>10</OPTION><OPTION selected
          value=20>20</OPTION><OPTION value=30>30</OPTION></SELECT>
          <DIV class=tpsrd>Show rows:</DIV>
          But I can not find a way write it. If anybody can show me how to do it, will be deep appreciated.

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 德庆县| 临潭县| 苏州市| 宣化县| 贵溪市| 松溪县| 来安县| 襄汾县| 南宁市| 华坪县| 闻喜县| 大悟县| 荔浦县| 新龙县| 深水埗区| 滕州市| 嵩明县| 彩票| 桐梓县| 平原县| 宣恩县| 瑞丽市| 吴忠市| 金阳县| 牟定县| 通许县| 彰化市| 潞城市| 临夏县| 夹江县| 灵山县| 天祝| 上蔡县| 正镶白旗| 祁连县| 四子王旗| 开江县| 台东市| 文成县| 红原县| 水城县|