javascript - Code seems to stop right after .responseXML. xmlDoc is null -
<!doctype html> <body> <script> if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.open("get","docu.xml",false); xmlhttp.send(); xmldoc=xmlhttp.responsexml; { // alert indicates xmldoc = null // nil else happens below. document.getelementbyid("stuff")=xmldoc.getelementsbytagname("details") [0].childnodes[0].nodevalue); } </script> <input type="text" name="stuff" id="stuff"/> </body> </html>
below docu.xml stored on root directory
<?xml=version '1.0'?> <root> <details>xml info not appear</details> </root>
javascript html xml
No comments:
Post a Comment