Created
November 26, 2013 18:01
-
-
Save panfeng/7662960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xpath_query = '//ul/li/a'; | |
var xpath_obj = document.evaluate(xpath_query ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); | |
var href_list = []; | |
for (var m=0; m<xpath_obj.snapshotLength; m++){ | |
href_list[m] = xpath_obj.snapshotItem(m).getAttribute("href"); | |
} | |
console.log(href_list); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment