2010-10-21 135 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中。

谢谢反正。