---
title: "webBrowser执行js"
author: "lin358"
date: "2017-05-27T16:30:59Z"
tags: []
categories: ["编程语言"]
slug: "webbrowser-js"
draft: false
lastmod: "2017-05-27T16:49:49Z"
id: 2376759
url: "https://lin358.iteye.com/blog/2376759"
---

```C#

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