- 最後登錄
- 2012-8-5
- 在線時間
- 978 小時
- UID
- 275
- 閱讀權限
- 140
- 精華
- 71
- 帖子
- 3799
- 日誌
- 0
- EXP
- 6040 點
- 金幣
- 4990 個
- 註冊時間
- 2008-3-27
- 帖子
- 3799
- EXP
- 6040 點
- 金幣
- 4990 個
- 好友
- 0
- 註冊時間
- 2008-3-27
|
插件名稱: 奧運獎牌榜
適用版本: Discuz! 6.X
作 者: Sina TW
演 示: http://044003.freehyperspace3.com/forumdisplay.php?fid=3
http://044003.freehyperspace3.com/index.php
聲 明: 本插件只有D6.X適用; 是採用新浪台灣數據,如有版權問題可刪除
修 改: 可在任何地方加上以下代碼:
- <script src="http://2008.sina.com.tw/get_medal_list.html" type="text/javascript"></script>
- <div class="mainbox">
- <h1>奧運獎牌榜</h1>
- <table summary="奧運獎牌榜" cellspacing="0" cellpadding="0" id="olympiclist">
- <thead class="category">
- <tr>
- <td>排名</td>
- <td>國家/地區</td>
- <td>金 / 銀 / 銅</td>
- <td>總數</td>
- </tr>
- </thead>
- </table>
- <script type="text/javascript">
- var medals_gold = 0;
- var medals_silver = 0;
- var medals_bronze = 0;
- var medals_country = 0;
- for(var i = 0; i < medals.length; i++) {
- medals_gold += parseInt(medals[i].gold);
- medals_silver += parseInt(medals[i].silver);
- medals_bronze += parseInt(medals[i].bronze);
- medals_country = parseInt(medals[i].gold) + parseInt(medals[i].silver) + parseInt(medals[i].bronze);
- i < 10 ? $('olympiclist').innerHTML += '<tr>' +
- '<td>' + medals[i].rank + '</td>' +
- '<td><img src="http://image.sina.com.tw/2008olympic/2008img/flag/logo_'+ medals[i].short +'.gif" width="20" height="13" align="absmiddle" /> ' + medals[i].country + '</td>' +
- '<td>' + medals[i].gold + ' / ' + medals[i].silver + ' / ' + medals[i].bronze + '</td>' +
- '<td>' + medals_country + '</td>' +
- '</tr>' : '';
- }
- var medals_all = medals_gold + medals_silver + medals_bronze;
- $('olympiclist').innerHTML += '<tr>' +
- '<td>總計</td>' +
- '<td><span style="padding-left: 24px">所有</span></td>' +
- '<td>' + medals_gold + ' / ' + medals_silver + ' / ' + medals_bronze + '</td>' +
- '<td>' + medals_all + '</td>' +
- '</tr>';
- </script>
- </div>
複製代碼
~完成~
補 充:
10 為顯示數目,並不能大於所有條數: 截至目前為止,共有44個國家入榜
首頁顯示左欄方法:
在 discuz 模板 找
之下加
找
-
- <!--{if empty($gid) && $announcements}-->
複製代碼
之上加
找
- <!--{if empty($gid) && $announcements}-->
- <script type="text/javascript">announcementScroll();</script>
- <!--{/if}-->
複製代碼
之上加
- </div>
- <div class="side mainbox">
- <script src="http://2008.sina.com.tw/get_medal_list.html" type="text/javascript"></script>
- <h1>奧運獎牌榜</h1>
- <table summary="奧運獎牌榜" cellspacing="0" cellpadding="0" id="olympiclist">
- <thead class="category">
- <tr>
- <td>排名</td>
- <td>國家/地區</td>
- <td>金 / 銀 / 銅</td>
- <td>總數</td>
- </tr>
- </thead>
- </table>
- <script type="text/javascript">
- var medals_gold = 0;
- var medals_silver = 0;
- var medals_bronze = 0;
- var medals_country = 0;
- for(var i = 0; i < medals.length; i++) {
- medals_gold += parseInt(medals[i].gold);
- medals_silver += parseInt(medals[i].silver);
- medals_bronze += parseInt(medals[i].bronze);
- medals_country = parseInt(medals[i].gold) + parseInt(medals[i].silver) + parseInt(medals[i].bronze);
- i < 10 ? $('olympiclist').innerHTML += '<tr>' +
- '<td>' + medals[i].rank + '</td>' +
- '<td><img src="http://image.sina.com.tw/2008olympic/2008img/flag/logo_'+ medals[i].short +'.gif" width="20" height="13" align="absmiddle" /> ' + medals[i].country + '</td>' +
- '<td>' + medals[i].gold + ' / ' + medals[i].silver + ' / ' + medals[i].bronze + '</td>' +
- '<td>' + medals_country + '</td>' +
- '</tr>' : '';
- }
- var medals_all = medals_gold + medals_silver + medals_bronze;
- $('olympiclist').innerHTML += '<tr>' +
- '<td>總計</td>' +
- '<td><span style="padding-left: 24px">所有</span></td>' +
- '<td>' + medals_gold + ' / ' + medals_silver + ' / ' + medals_bronze + '</td>' +
- '<td>' + medals_all + '</td>' +
- '</tr>';
- </script>
- </div>
- </div>
複製代碼
另補: Discuz! 6.1.0~F 簡易數據調用
系統設置->工具->數據調用->導入->選取以下文件
->提交
->設置->啟用邊欄->選取顯示的頁面->提交
~完成×2~ |
|