📄 form1.frm
字号:
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.dll"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8100
ClientLeft = 2265
ClientTop = 1740
ClientWidth = 9495
LinkTopic = "Form1"
ScaleHeight = 8100
ScaleWidth = 9495
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 615
Left = 1320
TabIndex = 1
Top = 480
Width = 2175
End
Begin SHDocVwCtl.WebBrowser WebBrowser1
Height = 5055
Left = 960
TabIndex = 0
Top = 2520
Width = 7695
ExtentX = 13573
ExtentY = 8916
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
NoWebView = 0 'False
HideFileNames = 0 'False
SingleClick = 0 'False
SingleSelection = 0 'False
NoFolders = 0 'False
Transparent = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = ""
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim webdoc As HTMLDocument
Dim eleColl As IHTMLElementCollection
Dim sElement As IHTMLElement
Private Sub Command1_Click()
Set eleColl = webdoc.All
For Each sElement In eleColl
Debug.Print sElement.outerHTML
If sElement.isTextEdit Then
If sElement.outerHTML = "<INPUT class=ff maxLength=100 size=35 name=wd>" Then
sElement.setAttribute "value", "软件测试"
End If
End If
Next
webdoc.Forms(0).submit
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "www.baidu.com"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set webdoc = Nothing
End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Set webdoc = WebBrowser1.Document
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -