当然不行,那个是整个网页的
郯城网站建设公司创新互联公司,郯城网站设计制作,有大型网站制作公司丰富经验。已为郯城成百上千家提供企业网站建设服务。企业网站搭建\外贸网站制作要多少钱,请找那个售后服务好的郯城做网站的公司定做!
要这样
web1=
webbrowser
1
For
i
=
To
Web1.Document.All.Count
-
1
'要具体判断是哪个控件还要看这两个
'Web1.Document.All(i).TagName
'Web1.Document.All(i).Name
Text1.Text=Web1.Document.All(i).InnerText
Next
i
webbrowser的newwindows中写代码
1 不弹出新窗口,但跳转到新网页
Set ppDisp = WebBrowser.Object
2 禁止弹出
cancel=true
如下两种方法,
1,
采用默认的浏览器打开FTP站点,不需要知道IE在什么地方,建议采用。
Shell("rundll32
url.dll
FileProtocolHandler
")
2,采用IE打开,只要更改为你的ie路径就可以了。不建议使用这个方法。
Shell("C:\Program
Files\Internet
Explorer\iexplore.exe
")
private void button1_Click(object sender, EventArgs e){webBrowser1.Navigate(textBox1.Text); webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);}void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e){if (webBrowser1.Document != null){HtmlDocument myDoc = webBrowser1.Document; HtmlElementCollection hc = myDoc.Body.GetElementsByTagName("A"); foreach (HtmlElement he in hc){he.SetAttribute("target", "_self");}}}追问: 能否写成VB.net语言?回答: 一样的,只是处理DocumentCompleted事件,这个在属性窗口就可以双击生成了追问: 我真是对你无语了 Private Sub button1_Click(sender As Object, e As EventArgs) webBrowser1.Navigate(textBox1.Text) webBrowser1.DocumentCompleted += New WebBrowserDocumentCompletedEventHandler(AddressOf webBrowser1_DocumentCompleted)End SubPrivate Sub webBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) If webBrowser1.Document IsNot Nothing Then Dim myDoc As HtmlDocument = webBrowser1.Document Dim hc As HtmlElementCollection = myDoc.Body.GetElementsByTagName("A") For Each he As HtmlElement In hc he.SetAttribute("target", "_self")NextEnd IfEnd Sub追问: 基本可以了,webBrowser1.DocumentCompleted += New WebBrowserDocumentCompletedEventHandler(AddressOf webBrowser1_DocumentCompleted)这一句貌似有问题。还有就是点击图标打开百度HI时还会弹出IE。回答: