2010-05-02 70 views
0

嘿傢伙,希望我可以得到一些幫助。在這裏有一個XML文件,每個文件都有唯一的ID和數字值,以確定它們是否被檢出。我需要一個JavaScript片段,在頁面加載並顯示XML文件的內容後請求XML文件。JavaScript片段在頁面加載時讀取和輸出XML文件?

XML文件是這樣的:

<?xml version="1.0" encoding="UTF-8" ?> 
    <response> 
     <library name="My Library"> 
     <book id="1" checked-out="1"> 
      <authors> 
      <author>John Resig</author> 
      </authors> 
      <title>Pro JavaScript Techniques (Pro)</title> 
      <isbn-10>1590597273</isbn-10> 
     </book> 
     <book id="2" checked-out="0"> 
      <authors> 
      <author>Erich Gamma</author> 
      <author>Richard Helm</author> 
      <author>Ralph Johnson</author> 
      <author>John M. Vlissides</author> 
      </authors> 
      <title>Design Patterns: Elements of Reusable Object-Oriented Software</title> 
      <isbn-10>0201633612</isbn-10> 
     </book> 
     ... 
     </library> 
    </response> 

喜歡任何和所有幫助!

+0

你使用的框架已經或只是原始的JavaScript? – prodigitalson 2010-05-02 17:56:52

回答