本文整理匯總了VB.NET中System.Windows.Forms.HtmlElement.InsertAdjacentElement方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET HtmlElement.InsertAdjacentElement方法的具體用法?VB.NET HtmlElement.InsertAdjacentElement怎麽用?VB.NET HtmlElement.InsertAdjacentElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.InsertAdjacentElement方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: AddDivMessage
Private Sub AddDivMessage()
Dim CurrentUri As New Uri(WebBrowser1.Url.ToString())
Dim HostName As String
' Ensure we have a host name, and not just an IP, against which to test.
If (Not CurrentUri.HostNameType = UriHostNameType.Dns) Then
Dim Permit As New DnsPermission(System.Security.Permissions.PermissionState.Unrestricted)
Permit.Assert()
Dim HostEntry As IPHostEntry = System.Net.Dns.GetHostEntry(CurrentUri.Host)
HostName = HostEntry.HostName
Else
HostName = CurrentUri.Host
End If
If (Not HostName.Contains("adatum.com")) Then
AddTopPageMessage("You are viewing a web site other than ADatum.com. " & _
"Please exercise caution, and ensure your web surfing complies with all " & _
"corporate regulations as laid out in the company handbook.")
End If
End Sub
Private Sub AddTopPageMessage(ByVal Message As String)
If (WebBrowser1.Document IsNot Nothing) Then
With WebBrowser1.Document
' Do not insert the warning again if it already exists.
Dim ReturnedElems As HtmlElementCollection = .All.GetElementsByName("ADatumWarningDiv")
If (Not (ReturnedElems Is Nothing) And (ReturnedElems.Count > 0)) Then
Exit Sub
End If
Dim DivElem As HtmlElement = .CreateElement("DIV")
DivElem.Name = "ADatumWarningDiv"
DivElem.Style = "background-color:black;color:white;font-weight:bold;width:100%;"
DivElem.InnerText = Message
DivElem = .Body.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterBegin, DivElem)
End With
End If
End Sub