开发者

Android HTML Parsing: Trigger a onclick event programatically

I have a Url/HTML page containing a Table of fields. Two of the input fields are dropdown/select.

Whe开发者_运维知识库n a particular element in the 1st dropdown is selected manually then the second dropdown list is populated with corresponding entries. There is a javascript written in onchange of the 1st select/dropdown field which is actually triggered on selection.

How can I do this programmatically? I want the html page which is formed after selecting the item in 1st dropdown list so i can parse it and get elements in 2nd dropdown list.

The 1st list is like this. On selecting any item the new list is formed in he next select tag

<select name="list1" onchange="javascript:setTimeout('__funtion1(\'list1\',\'\')', 0)" id="list1" tabindex="3" style="width:173px;">
  <option value="0">[Please select]</option>
  <option value="1">Aaaaa</option>
  <option value="2">bbbbbb</option>
  <option value="3">ccccc</option>
</select>

I somehow want the resulting page so that i can parse it and get the elements in the new list.


You don't need the resulting page, just get the options from the 2nd select:

list2.options[i];  

list2.options[i].text; // if you need the text

UPDATE: In this case simply call directly the onchange event handler __funtion1('list1','') (you can call a javascript function from the Android activity) to populate the 2nd select and then you're good to go

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜