<table>
<tbody>
I WANT it => <input type="hidden" name="prodCd_8801043014830" id="prodCd_8801043014830" value="8801043014830">
<input type="hidden" name="itemCd_8801043014830" id="itemCd_8801043014830" value="001">
<input type="hidden" name="categoryId_8801043014830" id="categoryId_8801043014830" value="C001001700010001">
<input type="hidden" name="maxQty_8801043014830" id="maxQty_8801043014830" value="20">
<input type="hidden" name="minQty_8801043014830" id="minQty_8801043014830" value="1">
<tr>
<-- CONTENTS-->
</tr>
I WANT it => <input type="hidden" name="prodCd_8801043015738" id="prodCd_8801043015738" value="8801043015738">
<input type="hidden" name="itemCd_8801043015738" id="itemCd_8801043015738" value="001">
<input type="hidden" name="categoryId_8801043015738" id="categoryId_8801043015738" value="C001001700010004">
<input type="hidden" name="maxQty_8801043015738" id="maxQty_8801043015738" value="31">
<input type="hidden" name="minQty_8801043015738" id="minQty_8801043015738" value="1">
<tr>
<-- CONTENTS-->
</tr>
HI我想獲取第一個元素和1 + 5n輸入隱藏標記值。隱藏標籤組TR標籤和輸入隱藏標籤之間沒有容器。如何通過標記獲取元素+使用選擇器的第5個值
我試圖2ways但他們返回惟獨第一個值
Document doc=Jsoup.connect("URL").timeout(5000).get();
a is integer value
for(int a=0;a<10;a++){
int n = 0+5a
1.Elements testattrval =
doc.select("table tbody input[type=hidden]:eq("+n+")");
2.Elements testattrval = doc.select("table tbody input[type=hidden]:nth-child(+"n+")");
}
該HTML無效。你不能把輸入元素放在你有的地方。 – Rob
爲什麼不使用className或ID? – kiro112
該HTML無效? 0_0我想學習HTML解析,所以我試着從互聯網購物商場解析信息。 :(...在這個頁面中,#productform(fomtag)有這個表格,我很樂意提供你的建議,我更喜歡:) http://www.lottemart.com/search/search.do?searchField= &searchTerm =%EA%B0%90%EC%9E%90&viewType = list – prepare123