ElementCollection

發布 ASP.NET 12


c#獲取HTML源文件后怎么讓其中一個button變灰不能點擊,操作的是HTML文件上的button,求大神指教
ElementCollection

mshtml.IHTMLDocument2 doc2 = (mshtml.IHTMLDocument2)Browser.Document;
    mshtml.IHTMLElementCollection inputs = (mshtml.IHTMLElementCollection)doc2.all.tags("INPUT");
    mshtml.HTMLInputElement input1 = (mshtml.HTMLInputElement)inputs.item("sfzmhm", 1);
    //input1.readOnly = true;
    //MessageBox.Show(input1.value);
    mshtml.HTMLInputElement input2 = (mshtml.HTMLInputElement)inputs.item("syr", 0);
    input2.value = "劉德華";
    mshtml.IHTMLElement element2 = (mshtml.IHTMLElement)inputs.item("buttonOK", 0);
    //不可用
    //element2.outerHTML = "<input id="buttonOK" name="buttonOK" disabled="disabled" type="button" class="button" value="確定(F8)" onclick="formsubmit();">";
    //可用
    element2.outerHTML = "<input id="buttonOK" name="buttonOK" type="button" class="button" value="確定(F8)" onclick="formsubmit();">";

Chrome測試你的代碼 是 OK的
 
美国扑克50手返水