把一个xml文档("note.xml")载入到xml解析器中
发布时间:2020-12-16 06:26:52 所属栏目:百科 来源:网络整理
导读:!--把一个xml文档("note.xml")载入到xml解析器中-- html head scropt type = "text/javascript" funcion parseXML() { try { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); }catch(e) { try { xmlDoc = document.implementation.createDocument("","",
<!--把一个xml文档("note.xml")载入到xml解析器中--> <html> <head> <scropt type = "text/javascript"> funcion parseXML() { try { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); }catch(e) { try { xmlDoc = document.implementation.createDocument("","",null); }catch(e) { alter(e.message); return; } } xmlDoc.async = false; xmlDoc.load("note.xml"); document.getElementById("to").innerHTML = xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue; xmlDoc.getElementById("from").innerHTML = xmlDoc.getElementsByTagName("from")[0].childNode[0].nodeValue; docuement.getElementById("message").innerHTML = xmlDoc.getElementsByTagName("message").innerHTML = xmlDoc.getElementTagName("body")[0].childNodes[0].nodeValue; } </script> </head> <body onload = "parseXML()"> <h1>W3School.com.cn Internal Note</h1> <p> <b>To:</b><span id = "to"></span><br /> <b>From:</b> <span id = "from"></span><br /> <b>Message:</b> <span id = "message"></span> </p> </body> </html> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |