C# 网页按钮回调form 函数
1. 绑定事件
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { foreach (System.Windows.Forms.HtmlElement el in this.webBrowser1.Document.GetElementsByTagName("a")) { //if (el.Name == " btnG ") { el.Click += new HtmlElementEventHandler(HtmlElement1_MouseDown); } } }
2. 处理回调
private void HtmlElement1_MouseDown(Object sender, HtmlElementEventArgs e) { //MessageBox.Show((sender as HtmlElement).InnerText); this.Text = (sender as HtmlElement).InnerText; }
作者微信号: xh66i88