1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-BE" lang="fr-BE">
<head>
<script type="text/javascript">
function loadXML(){
// Routine de vérification si le navigateur gêre la méthode utilisée
if (document.implementation && document.implementation.createDocument) {
// déclaration pour Mozilla et FF
docXml = document.implementation.createDocument('', '', null);
}
else if (window.ActiveXObject){
// déclaration pour IE
docXml = new ActiveXObject("Microsoft.XMLDOM");
}
else {
alert('Votre navigateur ne saurait pas éxécuter ce script.');
}
docXml.load("fic.xml");
}
function affplaylist() {
// on crée des variables de type Array, qui recoivent comme valeur les balises choisies dnas le document xml
var book = docXml.getElementsByTagName('nom');
var author = docXml.getElementsByTagName('auteur');
var parution = docXml.getElementsByTagName('date');
//alert(book[numero].firstChild.nodeValue);
var div = document.getElementById('writeroot');
var html = "<table>";
html += "<tr>";
html += "<td>";
html += book[0].firstChild.nodeValue;
html += "</td>";
html += "<td>";
html += author[0].firstChild.nodeValue;
html += "</td>";
html += "</tr>";
html += "<tr>";
html += "<td>";
html += book[1].firstChild.nodeValue;
html += "</td>";
html += "<td>";
html += author[1].firstChild.nodeValue;
html += "</td>";
html += "</tr>";
html += "<tr>";
html += "<td>";
html += book[2].firstChild.nodeValue;
html += "</td>";
html += "<td>";
html += author[2].firstChild.nodeValue;
html += "</td>";
html += "</tr>";
html += "</table>";
div.innerHTML = html;
}
window.onload = function() {
/*document.forms[0].reset();*/
loadXML();
/*document.forms[0].elements[1].onclick = function() {
biblio(document.forms[0].elements[0].value);*/
document.forms[0].elements[1].onclick = function() {
affplaylist() ;
};
};
</script>
<!--<script type="text/javascript" src="imp.js"></script> -->
</head>
<body>
<div id="all-box">
<A HREF="javascript:importXML()">link</A>
<A HREF="javascript:affplaylist()">test</A>
<hr />
</div>
<div id="writeroot">
</div>
</body>
</html> |
Partager