wap:wap
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| wap:wap [2017/02/20 14:52] – created george | wap:wap [2017/02/20 15:57] (current) – george | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | |||
| + | ===== Snippets ===== | ||
| + | |||
| + | * xpath example - showResult modification | ||
| + | |||
| + | <code javascript> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | <p id=" | ||
| + | |||
| + | < | ||
| + | var path = "/ | ||
| + | var xhttp = new XMLHttpRequest(); | ||
| + | xhttp.onreadystatechange = function() { | ||
| + | if (this.readyState == 4 && this.status == 200) { | ||
| + | showResult(xhttp.responseXML); | ||
| + | } | ||
| + | }; | ||
| + | xhttp.open(" | ||
| + | xhttp.send(); | ||
| + | |||
| + | function showResult(xml) { | ||
| + | var txt = ""; | ||
| + | var s = new XMLSerializer(); | ||
| + | if (xml.evaluate) { | ||
| + | var nodes = xml.evaluate(path, | ||
| + | var result = nodes.iterateNext(); | ||
| + | while (result) { | ||
| + | txt += "< | ||
| + | txt += result.childNodes[0].nodeValue + "< | ||
| + | txt += s.serializeToString(result) + "< | ||
| + | result = nodes.iterateNext(); | ||
| + | } | ||
| + | // Code For Internet Explorer | ||
| + | } else if (window.ActiveXObject || xhttp.responseType == " | ||
| + | xml.setProperty(" | ||
| + | nodes = xml.selectNodes(path); | ||
| + | for (i = 0; i < nodes.length; | ||
| + | txt += nodes[i].childNodes[0].nodeValue + "< | ||
| + | } | ||
| + | } | ||
| + | document.getElementById(" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </ | ||
wap/wap.1487598720.txt.gz · Last modified: 2017/02/20 14:52 by george
