ページ

2011年2月11日金曜日

Feed API - 5

■ タブ付きのフィードを表示する例です。


■ サンプルです。



<html>
<head>
<title>
Feed API サンプル-5
</title>

    <style type="text/css">
      body *, table *,
      body {
        font-family: "Arial", sans-serif;
        font-size: 13px;<!-- フィード内のコンテンツのフォントサイズ -->
      }

      #feedControl {
        width : 400px;<!-- 表示のサイズ設定です -->
        margin: 20px;
        }
    </style>

    <script src="http://www.google.com/jsapi/?key=API用のキーを取得してここに入力します" type="text/javascript"></script>

    <script language="Javascript" type="text/javascript">//<![CDATA[

      // AJAX Feed APIをロードします,”1”はAPIのバージョン
      google.load("feeds", "1");

      function OnLoad() {

        // feedControlの作成
        var feedControl = new google.feeds.FeedControl();
<!-- フィードURLの指定とタイトルを決めます。ここの行を増減させることで表示するタブとフィードを調整します -->
        feedControl.addFeed("http://www.radio-oh.com/rdf/whatsnew.rdf", "インターネットラジオ");
        feedControl.addFeed("http://www.radio-oh.com/rdf/jazzis.rdf", "Jazzis..");
        feedControl.addFeed("http://www5d.biglobe.ne.jp/~pog/gapps.xml", "Googleを追いかけろ!");
        feedControl.addFeed("http://feeds.feedburner.com/GoogleAppsUpdates", "AppdUpdates");

        feedControl.setLinkTarget(google.feeds.LINK_TARGET_BLANK);
        feedControl.setNumEntries(10);
        feedControl.draw(document.getElementById("feedControl"),
                         {drawMode : google.feeds.FeedControl.DRAW_MODE_TABBED});
      }
      google.setOnLoadCallback(OnLoad);
    //]]>
    </script>

  </head>

  <body>
<!-- フィードをbody内に表示させます。divタグはどこへ設置しても構いません。-->
    <div id="feedControl">Loading</div>
  </body>
  </html>