2010-10-21 77 views
0

我正在使用Google-Ajax-Feed-API編寫代碼以從網站獲取訂閱源。這是我的代碼相同。在IE中加載谷歌RSS訂閱

<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
     <title>Google AJAX Feed API - Simple Example</title> 
     <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA5MxjlekOJilywavs2TkrKxR3jjpvUIxSLOdaAPuufKrvVh6s1RSHnixBY86Q-Ze6bbbVdDtzvnIORA"></script> 
     <script type="text/javascript" src="jquery-1.4.2.min.js"></script> 
     <script type="text/javascript"> 

      google.load("feeds", "1"); 
      function initialize() { 
       feed = new google.feeds.Feed("http://feeds.labnol.org/labnol"); 
       feed.load(function(result) 
       { 
        if (!result.error) 
        { 
         var container = $("#feed"); 
         for (var i = 0; i < result.feed.entries.length; i++) 
         { 
          var entry = result.feed.entries[i]; 
          var header = $("<h2> <input type=\"checkbox\" name=\"rssItem\" /><span class=\"title\"> "+entry.title+" </span> </h2>"); 
          var dataStr = $("<em class=\"date\">"+entry.publishedDate+"</em><p class=\"description\">"+entry.contentSnippet+"</p><a target=\"_blank\" href=\""+entry.link+"\">Read more...</a>"); 
          var divObj = $("<div></div>"); 
          header.appendTo(divObj); 
          dataStr.appendTo(divObj); 
          divObj.appendTo(container); 
         } 
        } 
       });  
      } 
      google.setOnLoadCallback(initialize); 
    </script> 
    </head> 
    <body> 
     <div id="feed"></div> 
    </body> 
</html> 

這在Mozilla中完美工作,但在IE中沒有。任何人都可以告訴我在IE中出了什麼問題?

回答

0

很奇怪的問題,我只要一改變

feed = new google.feeds.Feed("http://feeds.labnol.org/labnol"); 

var feed = new google.feeds.Feed("http://feeds.labnol.org/labnol"); 

一切開始工作按預期在IE中。

謝謝反正。