PDA

View Full Version : turning getElementsByTagName into XPath



chrisdab
12-24-2008, 01:28 AM
So I have this xpath evaluate with these following variables:


var i, highestValue = boss.preferences.bounty_min, correspondingInput;
var inputs = document.evaluate("//input[@value='attack']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

to search for the target I want which outputs to
correspondingInput = inputs.snapshotItem(i);

How do I convert the next items and use them from the variable: correspondingInput

var target_id = divs[i].getElementsByTagName('INPUT')[12].value;
var bounty_id = divs[i].getElementsByTagName('INPUT')[13].value;


A second question is how do I use Firebug to find the full url for a button like this url. I see the input type elements but not the completed url for that button.


'http://apps.facebook.com/mobwars/fight/do.php?action=attack_bounty&target_id='+target_id+'&bounty_id='+bounty_id+'&from=/hitlist/index.php';