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
|
<html>
<head>
<script language="javascript">
function loadXML(handler){
if (document.implementation && document.implementation.createDocument) {
var xmldoc=document.implementation.createDocument("","",null);
xmldoc.onload=function() { handler(xmldoc); };
xmldoc.load("teste.xml");
} else if (window.ActiveXObject) {
var xmldoc=new ActiveXObject("Microsoft.XMLDOM");
xmldoc.onreadystatechange=function() {
if (xmldoc.readyState==4) handler(xmldoc);
};
xmldoc.load("teste.xml");
};
};
function compute(xmldoc){
var ls_prescription=xmldoc.getElementsByTagName('PRESCRIPTION');
libel=ls_prescription[0].getElementsByTagName('LIBEL')[0].firstChild.data;
alert('LIBEL='+libel);
desc=ls_prescription[0].getElementsByTagName('DESCRIPTION')[0];
class_th_cla=desc.getElementsByTagName('CLASS_THERA')[0].getAttribute('classif');
class_th_cod=desc.getElementsByTagName('CLASS_THERA')[0].getAttribute('code');
alert(class_th_cla+' '+class_th_cod);
};
</script>
</head>
<body>
<input type="button" onClick="javascript:loadXML(compute);"/>
</body>
</html> |