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

求助,WEBBROWSER中的点击问题

<div class="Mclck_center">
<ul>
  <li class="icon_0"><input type="button" onClick="alert('hello1')"  value="1" ></li>
                  <li class="icon_1"><input type="button" onClick="alert('hello2')"  value="2" ></li>
  <li class="icon_2"><input type="button" onClick="alert('hello3')"  value="3" ></li>
  <li class="icon_3"><input type="button" onClick="alert('hello4')"  value="4" ></li>
  <li class="icon_4"><input type="button" onClick="alert('hello5')"  value="5" ></li>
  <li class="icon_5"><input type="button" onClick="alert('hello6')"  value="6" ></li>
  <li class="icon_6"><input type="button" onClick="alert('hello7')"  value="7" ></li>
    <li class="icon_7"><input type="button" onClick="alert('hello8')"  value="8" ></li>
  <li class="icon_8"><input type="button" onClick="alert('hello9')"  value="9" ></li>
  <li class="icon_9"><input type="button" onClick="alert('hello0')"  value="0" ></li>
</ul>
  </div>


以上是我需要点击的LI中的BUTTON。在LI和BUTTON中是没有NAME和ID属性的。
请问我用HtmlElementCollection,怎么才能点击到BUTTON?,另外,我通过HtmlElement来获取这个DIV上的CLASS,然后从这个DIV中做点击

HtmlElement click = webBrowser1.Document.GetElementById("hide_dingwei");



             HtmlElementCollection c1 = click.GetElementsByTagName("li");
                for (int i = 0; i < c1.Count; i++ )
                {
                    c1[0].InvokeMember("click");
                }

上面是我写的代码,不知道为什么,C1总是报空指针错误。请各位大神帮帮忙。。。 --------------------编程问答-------------------- 试试 c1[0].GetElementsByTagName("input")[0] --------------------编程问答--------------------  对于代码我没学习过 莽荒纪
补充:.NET技术 ,  其他语言
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,