根据名称删除属性

  1. <html>
  2. <head>
  3. <script type="text/javascript" src="/example/xdom/loadxmldoc.js">
  4. </script>
  5. </head>
  6. <body>
  7.  
  8. <script type="text/javascript">
  9. xmlDoc=loadXMLDoc("/example/xdom/books.xml");
  10.  
  11. x=xmlDoc.getElementsByTagName('book');
  12.  
  13. document.write(x[0].getAttribute('category'));
  14. document.write("<br />");
  15.  
  16. x[0].removeAttribute('category');
  17.  
  18. document.write(x[0].getAttribute('category'));
  19.  
  20. </script>
  21. </body>
  22. </html>