//
using mshtml ;
private void webBrowser1_Navigated( object sender , WebBrowserNavigatedEventArgs e)
{
IHTMLDocument2 vDocument = ( IHTMLDocument2 )webBrowser1 . Document . DomDocument;
vDocument . parentWindow . execScript(
"function alert(str){if(str=='zswang')confirm(str);}" , "javaScript" );
}
//frame
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" );
}
}