16,722
社区成员




private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
IHTMLDocument2 vDocument = (IHTMLDocument2)webBrowser1.Document.DomDocument;
foreach (IHTMLElement vElement in vDocument.all)
{
if (vElement.tagName.ToUpper() == "FRAME")
{
IHTMLFrameBase2 vFrameBase2 = vElement as IHTMLFrameBase2;
vFrameBase2.contentWindow.execScript(
"function alert(str){confirm('[' + str + ']');}", "javaScript");
}
}
}
Private Sub webBrowser1_Navigated(ByVal sender As Object, ByVal e As WebBrowserNavigatedEventArgs)
Dim vDocument As IHTMLDocument2 = DirectCast(webBrowser1.Document.DomDocument, IHTMLDocument2)
For Each vElement As IHTMLElement In vDocument.all
If vElement.tagName.ToUpper() = "FRAME" Then
Dim vFrameBase2 As IHTMLFrameBase2 = TryCast(vElement, IHTMLFrameBase2)
vFrameBase2.contentWindow.execScript("function alert(str){confirm('[' + str + ']');}", "javaScript")
End If
Next
End Sub