|
回复 12# 的帖子
有一个就好啊!
Msgbox getMessageByDivId("dd0")
Function getMessageByDivId(strDivId)
'If the div not found
On error resume next
Set nodea = Browser("Creationtime:=0").Page("index:=0").Object.getElementById(strDivId)
If Err.number <> 0 Then getMessageByDivId = "" : Exit Function
Dim strReuslt
IterateNode nodea, strReuslt
getMessageByDivId = strReuslt
End Function
Function IterateNode(strNodeName, byref strReturn)
'If is a text node, get value.
If strNodeName.nodeType = 3 Then'3是文本节点,可根据需要调整为其它类型节点
atext = strNodeName.nodeValue
strReturn = strReturn & atext
Exit Function
End If
'For iteration.
Set childNod = strNodeName.childNodes
If Not IsEmpty(childNod) and childNod.length <> 0 Then
For i = 0 to childNod.length - 1
IterateNode childNod(i), strReturn
Next
End If
End Function |
|