当前位置:编程学习 > C#/ASP.NET >>

|zyciis|IHTMLDocument2 如何根据ID来得到HTML元素 谢谢

 IHTMLDocument2 doc = (IHTMLDocument2)this.webBrowser1.Document.DomDocument;
 text1 = (HTMLInputTextElement)doc.all.item("u", 0);
-------
<input type="text" id="u",name="u" value="123" />
上面这样可以得到name为u的HTML元素
那现在我要根据ID那上面的代码要怎么写

谢谢 --------------------编程问答-------------------- --------------------编程问答-------------------- 感觉HTML那里会这个的人应该很多! --------------------编程问答-------------------- this.webBrowser1.Document.GetElementById("u") --------------------编程问答-------------------- 可以
IHTMLDocument2 
要怎么用

谢谢 --------------------编程问答-------------------- 你可以
doc.all.tags("input")
遍历 --------------------编程问答-------------------- IHTMLDocument2 doc=(IHTMLDocument2)webBrowser1.Document.DomDocument;  
foreach(IHTMLElement ele in doc.all)  
{  
  if (ele.tagName.ToLower().Equlas("input "))  
  {  
  IHTMLInputElement iele= (IHTMLInputElement)vElement;  
  if (iele.type.ToLower() == "radio"&& iele.value.ToLower()=="4")  
  iele.@checked = true;  
  }  
}  
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,