webBrowser执行js

HtmlElement script = mainWebBrowser.Document.CreateElement("script");
script.SetAttribute("type", "text/javascript");
script.SetAttribute("text", "function _func_bank_" + b + @"(){
  document.getElementById('OTHER_BANK_DIV').innerHTML = '" + bankList[b].Value + @"';
  document.getElementById('otherbank').options[" + (b + 1) + @"].selected = true;
  otherBankChange();
}");
HtmlElement head = mainWebBrowser.Document.Body.AppendChild(script);
mainWebBrowser.Document.InvokeScript("_func_bank_" + b);


附详细教程链接:http://www.cnblogs.com/feiyuhuo/p/5474790.html

你可能感兴趣的:(C#,WebBrowser)