Func _IELinkClickByText(ByRef $o_object, $s_linkText, $i_index = 0, $f_wait = 1)
If Not IsObj($o_object) Then
__IEErrorNotify("Error", "_IELinkClickByText", "$_IEStatus_InvalidDataType")
Return SetError($_IEStatus_InvalidDataType, 1, 0)
EndIf
;
Local $found = 0, $linktext, $links = $o_object.document.links
$i_index = Number($i_index)
For $link In $links
$linktext = $link.outerText & "" ; Append empty string to prevent problem with no outerText (image) links
If $linktext = $s_linkText Then ; If StringInStr ($linktext , $s_linkText) Then
;;;;;;把上面的这个换成 If StringInStr ($linktext , $s_linkText) Then
If ($found = $i_index) Then
$link.click()
If $f_wait Then
_IELoadWait($o_object)
Return SetError(@error, 0, -1)
EndIf
Return SetError($_IEStatus_Success, 0, -1)
EndIf
$found = $found + 1
EndIf
Next
__IEErrorNotify("Warning", "_IELinkClickByText", "$_IEStatus_NoMatch")
Return SetError($_IEStatus_NoMatch, 0, 0) ; Could be caused by parameter 2, 3 or both
EndFunc ;==>_IELinkClickByText |