在这种情况下,我想从此列表中获取最后一个div的特定值:
<div id="past">
<div class="ball ball-8" data-rollid="242539">11</div>
<div class="ball ball-8" data-rollid="242540">11</div>
<div class="ball ball-1" data-rollid="242541">3</div>
<div class="ball ball-8" data-rollid="242542">11</div>
<div class="ball ball-1" data-rollid="242543">5</div>
<div class="ball ball-1" data-rollid="242544">2</div>
<div class="ball ball-1" data-rollid="242545">7</div>
<div class="ball ball-8" data-rollid="242546">14</div>
<div class="ball ball-1" data-rollid="242547">4</div>
<div class="ball ball-1" data-rollid="242548">3</div>
</div>
我只想从这个块的最后一个条目中获取outerText。在这种情况下,rollid="242548"
为3。
我怎么能得到这个价值?
我试过了:
$lasts = _IETagNameGetCollection($create, "div")
For $last In $lasts
If String($last.id) = "past" And String($last.innerText) = "242548" Then
$get = _IEGe
MsgBox(0,"","")
$outer = $last.outerText
GUICtrlSetData( $labellast, $outer)
EndIf
Next
但它不起作用。 有什么建议吗?
答案 0 :(得分:0)
试试这个
$past = _IEGetObjById($oIE,"past" )
$lasts = _IETagNameGetCollection($past, "div")
For $last In $lasts
If StringInStr($last.outerHtml, "242548") Then
$outer = $last.outerText
GUICtrlSetData( $labellast, $outer)
EndIf
Next