GetElementById如何获取tabindex C#的值

时间:2013-08-28 09:38:14

标签: javascript getelementbyid

我正在尝试通过使用此代码设置id来在webbrowser窗体中选择一个国家/地区代码: webBrowser1.Document.GetElementById("ulCountryMenu_alt").SetAttribute("value", "uk"); 但它在webbrowser中没有变化,或者我应该使用GetElementByTagName?

 <div id="ulCountryMenu_alt">
               <ul class="scroll-widget-scrollable scroll-widget-ulCountryMenu">
            <li tabindex="109" data-attr-val="+93" data-attr-country-code="af"><a href="#" aria-label="AfghanistaCn"><span class="famfamfam-flag-af"></span>&nbsp;Afghanistan (+93)</a></li><li tabindex="109" data-attr-val="+355" data-attr-country-code="al"><a href="#" aria-label="Albania"><span class="famfamfam-flag-al"></span>&nbsp;Albania (+355)</a></li><li tabindex="109" data-attr-val="+213" data-attr-country-code="dz"><a href="#" aria-label="Algeria"><span class="famfamfam-flag-dz"></span>&nbsp;Algeria (+213)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="as"><a href="#" aria-label="American Samoa"><span class="famfamfam-flag-as"></span>&nbsp;American Samoa (+1)</a></li><li tabindex="109" data-attr-val="+376" data-attr-country-code="ad"><a href="#" aria-label="Andorra"><span class="famfamfam-flag-ad"></span>&nbsp;Andorra (+376)</a></li><li tabindex="109" data-attr-val="+244" data-attr-country-code="ao"><a href="#" aria-label="Angola"><span class="famfamfam-flag-ao"></span>&nbsp;Angola (+244)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="ai"><a href="#" aria-label="Anguilla"><span class="famfamfam-flag-ai"></span>&nbsp;Anguilla (+1)</a></li><li tabindex="109" data-attr-val="+672" data-attr-country-code="aq"><a href="#" aria-label="Antarctica"><span class="famfamfam-flag-aq"></span>&nbsp;Antarctica (+672)</a></li><li tabindex="109" data-attr-val="+1268" data-attr-country-code="ag"><a href="#" aria-label="Antigua, Barbuda"><span class="famfamfam-flag-ag"></span>&nbsp;Antigua, Barbuda (+1268)</a></li><li tabindex="109" data-attr-val="+54" data-attr-country-code="ar"><a href="#" aria-label="Argentina"><span class="famfamfam-flag-ar"></span>&nbsp;Argentina (+54)</a></li><li tabindex="109" data-attr-val="+374" data-attr-country-code="am"><a href="#" aria-label="Armenia"><span class="famfamfam-flag-am"></span>&nbsp;Armenia (+374)</a></li><li tabindex="109" data-attr-val="+297" data-attr-country-code="aw"><a href="#" aria-label="Aruba"><span class="famfamfam-flag-aw"></span>&nbsp;Aruba (+297)</a></li><li tabindex="109" data-attr-val="+247" data-attr-country-code="ac"><a href="#" aria-label="Ascension"><span class="famfamfam-flag-ac"></span>&nbsp;Ascension (+247)</a></li><li tabindex="109" data-attr-val="+61" data-attr-country-code="au"><a href="#" aria-label="Australia"><span class="famfamfam-flag-au"></span>&nbsp;Australia (+61)</a></li><li tabindex="109" data-attr-val="+43" data-attr-country-code="at"><a href="#" aria-label="Austria"><span class="famfamfam-flag-at"></span>&nbsp;Austria (+43)</a></li><li tabindex="109" data-attr-val="+994" data-attr-country-code="az"><a href="#" aria-label="Azerbaidijan"><span class="famfamfam-flag-az"></span>&nbsp;Azerbaidijan (+994)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="bs"><a href="#" aria-label="Bahamas"><span class="famfamfam-flag-bs"></span>&nbsp;Bahamas (+1)</a></li><li tabindex="109" data-attr-val="+973" data-attr-country-code="bh"><a href="#" aria-label="Bahrain"><span class="famfamfam-flag-bh"></span>&nbsp;Bahrain (+973)</a></li><li tabindex="109" data-attr-val="+880" data-attr-country-code="bd"><a href="#" aria-label="Bangladesh"><span class="famfamfam-flag-bd"></span>&nbsp;Bangladesh (+880)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="bb"><a href="#" aria-label="Barbados"><span class="famfamfam-flag-bb"></span>&nbsp;Barbados (+1)</a></li><li tabindex="109" data-attr-val="+375" data-attr-country-code="by"><a href="#" aria-label="Belarus"><span class="famfamfam-flag-by"></span>&nbsp;Belarus (+375)</a></li><li tabindex="109" data-attr-val="+32" data-attr-country-code="be"><a href="#" aria-label="Belgium"><span class="famfamfam-flag-be"></span>&nbsp;Belgium (+32)</a></li><li tabindex="109" data-attr-val="+501" data-attr-country-code="bz"><a href="#" aria-label="Belize"><span class="famfamfam-flag-bz"></span>&nbsp;Belize (+501)</a></li><li tabindex="109" data-attr-val="+229" data-attr-country-code="bj"><a href="#" aria-label="Benin"><span class="famfamfam-flag-bj"></span>&nbsp;Benin (+229)</a></li><li tabindex="109" data-attr-val="+1441" data-attr-country-code="bm"><a href="#" aria-label="Bermuda"><span class="famfamfam-flag-bm"></span>&nbsp;Bermuda (+1441)</a></li><li tabindex="109" data-attr-val="+975" data-attr-country-code="bt"><a href="#" aria-label="Bhutan"><span class="famfamfam-flag-bt"></span>&nbsp;Bhutan (+975)</a></li><li tabindex="109" data-attr-val="+591" data-attr-country-code="bo"><a href="#" aria-label="Bolivia"><span class="famfamfam-flag-bo"></span>&nbsp;Bolivia (+591)</a></li><li tabindex="109" data-attr-val="+387" data-attr-country-code="ba"><a href="#" aria-label="Bosnia & Herzegovina"><span class="famfamfam-flag-ba"></span>&nbsp;Bosnia & Herzegovina (+387)</a></li><li tabindex="109" data-attr-val="+267" data-attr-country-code="bw"><a href="#" aria-label="Botswana"><span class="famfamfam-flag-bw"></span>&nbsp;Botswana (+267)</a></li><li tabindex="109" data-attr-val="+55" data-attr-country-code="br"><a href="#" aria-label="Brazil"><span class="famfamfam-flag-br"></span>&nbsp;Brazil (+55)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="vg"><a href="#" aria-label="British Virgin Islands"><span class="famfamfam-flag-vg"></span>&nbsp;British Virgin Islands (+1)</a></li><li tabindex="109" data-attr-val="+673" data-attr-country-code="bn"><a href="#" aria-label="Brunei Darussalam"><span class="famfamfam-flag-bn"></span>&nbsp;Brunei Darussalam (+673)</a></li><li tabindex="109" data-attr-val="+359" data-attr-country-code="bg"><a href="#" aria-label="Bulgaria"><span class="famfamfam-flag-bg"></span>&nbsp;Bulgaria (+359)</a></li><li tabindex="109" data-attr-val="+226" data-attr-country-code="bf"><a href="#" aria-label="Burkina Faso"><span class="famfamfam-flag-bf"></span>&nbsp;Burkina Faso (+226)</a></li><li tabindex="109" data-attr-val="+257" data-attr-country-code="bi"><a href="#" aria-label="Burundi"><span class="famfamfam-flag-bi"></span>&nbsp;Burundi (+257)</a></li><li tabindex="109" data-attr-val="+855" data-attr-country-code="kh"><a href="#" aria-label="Cambodia"><span class="famfamfam-flag-kh"></span>&nbsp;Cambodia (+855)</a></li><li tabindex="109" data-attr-val="+237" data-attr-country-code="cm"><a href="#" aria-label="Cameroon"><span class="famfamfam-flag-cm"></span>&nbsp;Cameroon (+237)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="ca"><a href="#" aria-label="Canada"><span class="famfamfam-flag-ca"></span>&nbsp;Canada (+1)</a></li><li tabindex="109" data-attr-val="+238" data-attr-country-code="cv"><a href="#" aria-label="Cape Verde"><span class="famfamfam-flag-cv"></span>&nbsp;Cape Verde (+238)</a></li><li tabindex="109" data-attr-val="+1345" data-attr-country-code="ky"><a href="#" aria-label="Cayman Islands"><span class="famfamfam-flag-ky"></span>&nbsp;Cayman Islands (+1345)</a>

0 个答案:

没有答案