當前位置:首頁 » 操作系統 » vbwebbrowser網頁源碼

vbwebbrowser網頁源碼

發布時間: 2024-04-14 03:19:14

㈠ 如何用vb webbrowser獲取帶框架網頁的全部源代碼

用vb webbrowser獲取帶框架網頁的全部源代碼,指令如下:

WebBrowser1.Document.frames(0).Document.documentElement.outerHTML

遍歷框架就可以得到所有的(WebBrowser1.Document.frames(0).count框架個數)。

㈡ vb 如何在WebBrowser控制項中修改網頁源碼,達到自動登錄的效果

設置一下
WebBrowser(WebBrowser1)的屬性吧
Private
Sub
Form_Load()WebBrowser1.Navigate
("源碼來源的網址")WebBrowser1 .Document.all("username").value
=
你的賬戶WebBrowser1 .Document.all("password").value
=
你的密碼End
Sub
Private
Sub
Command1_Click()WebBrowser1 .Document.all("submit")。clickEnd
Sub

㈢ VB如何獲取webbrowser源碼指定文本

第一個紅框的文本:
WebBrowser1.Document.getElementById("list_uin").getElementsByTagName("label")(0).innerText

第二個紅框的文本:
WebBrowser1.Document.getElementById("list_uin").getElementsByTagName("label")(1).innerText

㈣ 用vb獲取任一網頁源代碼,要完整的!!!,可以用webbrowser控制項

'你把下面的代碼保存為Form1.frm,然後雙擊打開該文件,運行後按提示即可看到結果。
'呵呵,夠詳細了,再不會我也沒辦法了。

'====文件Form1.frm====

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5265
ClientLeft = 60
ClientTop = 450
ClientWidth = 9000
LinkTopic = "Form1"
ScaleHeight = 5265
ScaleWidth = 9000
StartUpPosition = 3 '窗口預設
Begin VB.TextBox Text2
Height = 3735
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 480
Width = 8655
End
Begin VB.TextBox Text1
Height = 270
Left = 2040
TabIndex = 1
Text = "我的家"
Top = 120
Width = 4095
End
Begin VB.CommandButton Command1
Caption = "獲取HTML源碼"
Height = 615
Left = 3480
TabIndex = 0
Top = 4440
Width = 1575
End
Begin VB.Label Label2
Caption = "注意:獲取源碼之前必須先用IE打開網址,然後輸入窗口標題關鍵字。如www.51.com的標題關鍵字是:我的家"
Height = 615
Left = 240
TabIndex = 4
Top = 4440
Width = 3135
End
Begin VB.Label Label1
Caption = "請輸入IE窗口標題:"
Height = 255
Left = 120
TabIndex = 3
Top = 120
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Function GetIeHtml(IeTitle As String) As String
Dim oShellApp: Set oShellApp = CreateObject("Shell.Application")
Dim oShellAppWindows: Set oShellAppWindows = oShellApp.Windows
Dim owin

'獲取彈出的IE窗口
For Each owin In oShellAppWindows '獲取彈出的IE窗口
If LCase(TypeName(owin.Document)) = "htmldocument" And _
InStr(1, owin.LocationName, IeTitle, vbTextCompare) > 0 Then '如果找到符合條件的IE窗口
GetIeHtml = owin.Document.activeElement.Document.documentElement.innerHTML '此句可獲得完整html代碼
GoTo Mend '退出
End If
Next

Mend:
Set oShellAppWindows = Nothing
Set oShellApp = Nothing
Set owin = Nothing

End Function

Private Sub Command1_Click()
Dim S As String
S = GetIeHtml(Text1.Text) '表示獲得標題含有"我的家"的html代碼
Text2.Text = S
End Sub

Private Sub Form_Load()
'Shell "explorer.exe ""http://www.51.com/""", vbNormalNoFocus
End Sub

㈤ 濡備綍鐢╲b.net鑾峰彇緗戦〉婧愪唬鐮

浣跨敤webbrowser鎺т歡鏉ュ姞杞界綉欏碉紝鐒跺悗鍐 Private Sub WebBrowser1_DocumentCompleted涓嬮氳繃浣跨敤WebBrowser1.Document.Body.InnerHtml 鏉ヨ幏鍙栫綉欏電殑婧愪唬鐮侊紝鎴栦嬌鐢 WebBrowser1.Document.Body.InnerText鏉ヨ幏鍙栫綉欏典腑鐨勬枃鏈銆備箣鍚庡彲浠ラ氳繃瀛楃︿覆鎺у埗鎸囦護鎴栬呮e垯琛ㄨ揪寮忔潵綺劇『鑾峰彇鍒頒綘鎵闇鐨勬暟鎹銆

㈥ vb WebBrowser1緗戦〉婧愮爜 涓嶅畬鏁

娌″繀瑕佺敤 createtextrange銆

鐩存帴
WebBrowser1.document.documentElement.outerHTML
鎴栬
WebBrowser1.document.all(0).outerHTML
灝辮兘鑾峰彇婧愮爜浜嗐

涓嶈繃榪欎簺閮芥槸涓嶅寘鍚宓屽楀湪鍐呯殑frame閲岀殑緗戦〉婧愮爜銆

熱點內容
對一個新編程 發布:2024-05-02 21:20:07 瀏覽:559
華為系統編譯器在哪裡 發布:2024-05-02 21:19:50 瀏覽:86
ebsco資料庫檢索 發布:2024-05-02 21:18:51 瀏覽:82
python遞歸創建目錄 發布:2024-05-02 21:02:38 瀏覽:280
資料庫分離與附加 發布:2024-05-02 20:56:59 瀏覽:40
搭建我的世界java伺服器詳細篇 發布:2024-05-02 20:56:59 瀏覽:942
string函數java 發布:2024-05-02 20:36:49 瀏覽:801
phplinux伺服器 發布:2024-05-02 20:30:23 瀏覽:754
安卓在哪裡安裝網易官方手游 發布:2024-05-02 20:15:07 瀏覽:409
qq寵物的文件夾 發布:2024-05-02 20:13:46 瀏覽:366