[Greasemonkey] evaluate in evaluate results?
yosho
nospam292-greasemonkey at yahoo.com
Sat Jun 4 18:02:18 EDT 2005
Put a period in front of the expression to narrow the scope.
i.e. ".//FONT"
--- chayes at antenna.nl wrote:
>
>
> Dear greasies,
> I was hoping to use evaluate() on the table-node I found with evaluate(), but it
> seems to be looking in a wider context.
>
> Eventually I want to pick several elements out the table-node.
>
> //get message tables
> var messages = document.evaluate("//BODY/TABLE[2]/TBODY/TR/[etc]/TABLE",
> document,
> null,
> XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
> null);
> messages_count=0;
> while(message= messages.snapshotItem(messages_count))
> { alert(messagez_count+' = '+message.innerHTML);
> // shows a single message, as expected
>
> inside_messages =
> document.evaluate("//FONT",
> messagze,
> null,
> XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
> null);
> if (inside_messages.snapshotItem) //is this a good test?
> { io=0;
> while(ins_message= inside_messages.snapshotItem(io))
> {io++;
> alert(ins_message.innerHTML);
> //the list of results seem to be coming out of a higher level table
> // and same list is repeated
> }
> }
>
> messages_count++;
> }
>
> It may be worth mentioning that I did another evaluate higher in the code, but
> with different variable names.
>
> Thank you for pointing me in the right direction, or more examples of finding
> nodes within a resultset.
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>
More information about the Greasemonkey
mailing list