1. 启动速度超慢
form大约15秒钟之后才出现,为什么会这么慢啊2. 怎样获得没有名字的按钮?
比如 <INPUT type=submit value=登录>

解决方案 »

  1.   

    对2的解答:
    可以用IHTMLDocument2接口跟IHTMLWindow2接口解决,方法是:
    在引用那里添加 Microsoft mshtml 然后:
      

  2.   

    IHTMLDocument2 doc=(IHTMLDocument2)axWebBrowser1.Document;
    IHTMLWindow2 win=doc.parentWindow; string script="for(i=0;i<document.body.all.length;i++){";
    script+="if(document.body.all[i].type==\"submit\"){alert(document.body.all[i].value); }}";
    win.execScript(script,"javascript");
      

  3.   

    好象没那么慢吧,我在FORMLOAD中加入了好多读注册表的代码等,好象不到10秒,
    HTMLDocument doc=(HTMLDocument)axWebBrowser1.Document;
    foreach(IHTMLElement iet in doc.getElementsByTagName("input"))
    {
    if (iet.value=="登录")
    iet.click();
    }
      

  4.   

    1. 好像是debug的时候启动很慢。在vs外启动速度还行2. 能不能不用javascript,直接遍历IHTMLDocument2里的元素?
      

  5.   

    我的方法就是用javascript遍历的
    楼上的楼上的方法是用C#便利的
      

  6.   

    我的方法应该能满足你的要求了,如果你的document中有两个以上VALUE=“登录”的INPUT元素的话,你可在判断时加入type=="submit"
    HTMLDocument doc=(HTMLDocument)axWebBrowser1.Document;
    foreach(IHTMLElement iet in doc.getElementsByTagName("input"))
    {
    if(iet is HTMLInputElementClass)
    {
    HTMLInputElementClass inp=(HTMLInputElementClass)iet;
    if (iet.value=="登录"&&inp.type=="submit")
    iet.click();
    }
    }