Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
...
function xmlImportXML(pageName) {
// Import the XML into the webpage
if (document.implementation && document.implementation.createDocument) {
xmlDoc = document.implementation.createDocument("", "", null);
// process the document once it has loaded
xmlDoc.onload = xmlCreateArray();
} else if (window.ActiveXObject) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
// process the document once it has loaded
xmlDoc.onreadystatechange = function () {if (xmlDoc.readyState == 4) xmlCreateArray()};
} else {
alert('Your browser can\'t handle this script');
return;
}
xmlResults.innerHTML="<span class='message'>Please wait... loading</span>";
xmlDoc.load(pageName);
}
...
...
<div id="xmlResults"></div>
<script language="JavaScript">
<!--
xmlImportXML("../xml/ac7.3.1-annualresults.xml");
//-->
</script>
...
XML Document - save it as "states.xml":
<States>
<State ref="FL">
<name>Florida</name>
<capital>Tallahassee</capital>
</State>
<State ref="IA">
<name>Iowa</name>
<capital>Des Moines</capital>
</State>
</States>
HTML Document to extract the information:
<html>
<head>
<title>XML Example</title>
</head>
<body>
<script>
var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("states.xml");
var f_child = xml_doc.documentElement.firstChild.text;
document.write("First: " + f_child);
f_child = xml_doc.documentElement.firstChild.nextSibling.text;
document.write("<br>Second: " + f_child);
</script>
</body>
</html>
.load(
xmlDoc.load(pageName);
document.getElementsByTagName('head')
javascript:alert(document.getElementsByTagName('head')[0].innerHTML);