getElementByID를 사용하지 않고 div의 innerHTML을 가져 오려면 (이 웹 사이트에는 'quote'를 id로 사용하는 여러 div가 포함되어 있음을 고려해야하지만 'field name'(field = "bid"). 어떻게 그럴 수 있니?div의 내부 HTML
<div nowrap="nowrap" id="quote" class="realtimeDetailLayer" source="lightstreamer"
style="display:inline" table="LS_ProductDetails_TabID" item="X0000010600NL0010379129"
field="bid">0,28</div>
기존 웹 사이트에서 정보를 검색하고 싶습니다. 아래를보십시오. 여러 개의 div가 동일한 ID를 가지고 있음을 알 수 있습니다.
<tbody>
<tr>
<td style="text-align:right;width:auto;padding:8px 0px;"><nobr>Ref.</nobr>:</td>
<td class="ext04" style="white-space:nowrap;width:12%;font-weight:bold;">
EUR
<strong><div nowrap=nowrap id="quote" class="realtimeDetailLayer" source="lightstreamer" style="display:inline" table="LS_ProductDetails_TabID" item="X0000010600NL0010379129" field="reference">350,85
</div></strong>
</td>
<td style="text-align:right;width:auto;padding:8px 0px;"><nobr>Bied</nobr>:</td>
<td class="ext04" style="white-space:nowrap;width:12%;font-weight:bold;">
EUR
<div nowrap=nowrap id="quote" class="realtimeDetailLayer" source="lightstreamer" style="display:inline" table="LS_ProductDetails_TabID" item="X0000010600NL0010379129" field="bid">0,28</div>
</td>
<td style="text-align:right;width:auto;padding:8px 0px;">
<nobr>Laat</nobr>:
</td>
<td class="ext04" style="white-space:nowrap;width:12%;font-weight:bold;">
EUR
<div nowrap=nowrap id="quote" class="realtimeDetailLayer" source="lightstreamer" style="display:inline" table="LS_ProductDetails_TabID" item="X0000010600NL0010379129" field="ask">0,29
</div>
</td>
<td style="text-align:right;width:auto;padding:8px 0px;"><nobr>%</nobr>:</td>
<td class="ext04" style="white-space:nowrap;width:12%;font-weight:bold;">
<div nowrap=nowrap id="quote" class="realtimeDetailLayer" source="lightstreamerGeneratedValues" style="display:inline" table="LS_ProductDetails_TabID" item="X0000010600NL0010379129" field="midchangepercent"><span class="extNegative"><nobr>-50,88 %</nobr></span>
</div>
</td>
</tr>
</tbody>
ID는 에서 독특한 – Pete
살펴해야http://stackoverflow.com/questions/9496427/how-to-get-elements-by-attribute-selector-w-native-javascript-wo-queryselector –
@Shiju 당신은 * 페이지에 같은 ID를 가질 수 있습니다. , 그러나 당신은 * 그렇게해서는 안됩니다 *. – RemarkLima