如何读取html标记之间的数据,如<strong>。例如。
<strong id="food">40</strong>如何从那里检索整数40?我试过了
myBrowser.Document.GetElementById("food").GetAttribute("value");
发布于 2012-03-01 02:26:59
InnerText
[STAThread]
static void Main(string[] args)
{
WebBrowser w = new WebBrowser();
w.Navigate(String.Empty);
HtmlDocument doc = w.Document;
doc.Write("<html><head></head><body><p id=\"food\">40</p></body></html>");
Console.WriteLine(doc.GetElementById("food").InnerText);
Console.ReadKey();
}https://stackoverflow.com/questions/9504540
复制相似问题