获得脚本信息:
Private Sub button3_Click(sender As Object,e As EventArgs) Handles button3.Click Dim doc As msHTML.IHTMLdocument doc = wbMain.document.Domdocument Dim scrs As msHTML.IHTMLElementCollection = doc.scripts Dim scr As msHTML.IHTMLScriptElement For i As Integer = 0 To scrs.length - 1 scr = CType(scrs.item(i),msHTML.IHTMLScriptElement) txtInfo.Text &= "HTMLFor:" & scr.HTMLFor & vbCrLf txtInfo.Text &= "event:" & scr.event & vbCrLf txtInfo.Text &= "src:" & scr.src & vbCrLf txtInfo.Text &= "text:" & scr.text & vbCrLf txtInfo.Text &= "type:" & scr.type & vbCrLf txtInfo.Text &= "====================" & vbCrLf Next End Sub运行如下: 获得样式表信息:
Private Sub button4_Click(sender As Object,e As EventArgs) Handles button4.Click Dim doc As msHTML.IHTMLdocument2 doc = wbMain.document.Domdocument Dim styles As msHTML.HTMLStyleSheetsCollection = doc.styleSheets Dim style As msHTML.IHTMLStyleSheet For i As Integer = 0 To styles.length - 1 style = CType(styles.item(i),msHTML.IHTMLStyleSheet) txtInfo.Text &= "csstext:" & style.csstext & vbCrLf txtInfo.Text &= "href:" & style.href & vbCrLf txtInfo.Text &= "ID:" & style.ID & vbCrLf txtInfo.Text &= "Title:" & style.Title & vbCrLf txtInfo.Text &= "type:" & style.type & vbCrLf txtInfo.Text &= "====================" & vbCrLf Next End Sub运行如下: 获得表单信息:
Private Sub button5_Click(sender As Object,e As EventArgs) Handles button5.Click Dim doc As msHTML.HTMLdocument doc = wbMain.document.Domdocument doc.sc Dim eles As msHTML.IHTMLElementCollection = doc.forms Dim frm As msHTML.IHTMLFormElement For i As Integer = 0 To eles.length - 1 frm = CType(eles.item(i),msHTML.IHTMLFormElement) txtInfo.Text &= "action:" & frm.action & vbCrLf txtInfo.Text &= "enCoding:" & frm.enCoding & vbCrLf txtInfo.Text &= "method:" & frm.method & vbCrLf txtInfo.Text &= "name:" & frm.name & vbCrLf txtInfo.Text &= "target:" & frm.target & vbCrLf txtInfo.Text &= "====================" & vbCrLf Next End Sub运行如下:
由于.net平台下C#和vb.NET很相似,本文也可以为C#爱好者提供参考。
学习更多vb.net知识,请参看 vb.net 教程 目录
总结以上是内存溢出为你收集整理的vb.net 教程 12-4 msHtml 3全部内容,希望文章能够帮你解决vb.net 教程 12-4 msHtml 3所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)