在一个窗体里托放一个文本框、一个按钮和一个webbrowser,代码如下: Private Sub Command1_Click() WebBrowser1.Navigate "http://www.baidu.com" End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) WebBrowser1.Document.Forms(0).wd.Value = Text1 End Sub 你所需要的,就是在webbrowser的documentComplete事件中编码
Private Sub Command1_Click() WebBrowser1.Navigate "http://www.baidu.com" End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) If URL = "http://www.baidu.com/" Then WebBrowser1.Document.Forms(0).wd.Value = Text1 End Sub
在Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)里在用 If URL = "http://www.baidu.com/" Then ,除非你每次下载网页结束后就再次刷新
Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.baidu.com"
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
WebBrowser1.Document.Forms(0).wd.Value = Text1
End Sub
你所需要的,就是在webbrowser的documentComplete事件中编码
对象变量或with 块变量未设置
Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.baidu.com"
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If URL = "http://www.baidu.com/" Then WebBrowser1.Document.Forms(0).wd.Value = Text1
End Sub
If URL = "http://www.baidu.com/" Then ,除非你每次下载网页结束后就再次刷新