解析XML文件

  1. <html>
  2. <body>
  3. <scripttype="text/javascript">
  4. try//InternetExplorer
  5. {
  6. xmlDoc=newActiveXObject("Microsoft.XMLDOM");
  7. }
  8. catch(e)
  9. {
  10. try//Firefox,Mozilla,Opera,etc.
  11. {
  12. xmlDoc=document.implementation.createDocument("","",null);
  13. }
  14. catch(e){alert(e.message)}
  15. }
  16. try
  17. {
  18. xmlDoc.async=false;
  19. xmlDoc.load("books.xml");
  20. document.write("xmlDocisloaded,readyforuse");
  21. }
  22. catch(e){alert(e.message)}
  23. </script>
  24. </body>
  25. </html>

你可能感兴趣的:(JavaScript,xml,Microsoft,Opera,firefox)