C#中WebBrowser 获取页面标签class值

2024-12-13 09:00:04
推荐回答(1个)
回答1:

由于class是JavaScript的保留关键字,所以在ie中用className代替class

foreach (HtmlElement he in web_bs.Document.GetElementsByTagName(“DIV“))
{
rtb_html.Text = he.GetAttribute(“className“);

if (rtb_html.Text==“aainText“)
{
rtb_txt.Text = he.InnerHtml;
}

}