【求教】WebBrowser打开一张网页时,如何插入JS代码
如题WebBrowser打开一张网页时,如何插入JS代码
[解决办法]
贴个C#的你照着改吧
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 ");
}