<div style="width:100%"> <table id="scoregame" width="100%" border="1"> <tr> <th class="country"></th> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>得分</th> <th>安打</th> <th>失誤</th> </tr> <tr> <th class="country">中華</th> <td id="as0"></td> <td id="as2"></td> <td id="as4"></td> <td id="as6"></td> <td id="as8"></td> <td id="as10"></td> <td id="as12"></td> <td id="as14"></td> <td id="as16"></td> <td id="at1"></td> <td id="ah1"></td> <td id="ae1"></td> </tr> <tr> <th class="country">古巴</th> <td id="as1"></td> <td id="as3"></td> <td id="as5"></td> <td id="as7"></td> <td id="as9"></td> <td id="as11"></td> <td id="as13"></td> <td id="as15"></td> <td id="as17"></td> <td id="at2"></td> <td id="ah2"></td> <td id="ae2"></td> </tr> </table> <table id="livegame" width="100%" border="1"> <tr> <th width="13%">局數</th> <th>轉播內容</th> </tr> </table> <!-- 程式語法 --> <script type="text/javascript" src="//libs.pixfs.net/jquery-plugins/timers/1.1.2/jquery.timers.js"></script> <script type="text/javascript"> function processArticleScore(ret) { jQuery('#at1').html(ret.t1); jQuery('#at2').html(ret.t2); jQuery('#ah1').html(ret.h1); jQuery('#ah2').html(ret.h2); jQuery('#ae1').html(ret.e1); jQuery('#ae2').html(ret.e2); for (var i = 0; i < ret.s.length; i++) { jQuery('#as'+i).html(ret.s[i]); } } function loadArticleScore() { jQuery.ajax({url:'http://wbctaiwan.events.pixnet.net/blog/api.php?type=score',dataType:'jsonp',jsonp:'callback',jsonpCallback:'processArticleScore'}); } jQuery(document).everyTime(30000, 'none', loadArticleScore).ready(function () { loadArticleScore(); }); function processLiveData(ret) { var block = '<tr><th width="13%">局數</th><th>轉播內容</th></tr>'; for (var i = 0; i < ret.length; i++) { var word = (1 == ret[i].type ? '上' : '下'); var type = ret[i].round+' 局'+word; block += '<tr><td>'+type+'</td><td>'+ret[i].body+'</td></tr>'; if (i == 1) { block += '<tr><td colspan="2"><a href="http://ad.pixnet.net/newdirect.php?aid=111957" target="_blank"><img style="margin: 0px; padding: 2px; border: 1px solid #cccccc; max-width: 530px;" src="https://pimg.1px.tw/wbctaiwan/1362485704-1278497578.jpg" alt="" width="510" /></a></td></tr>'; } } jQuery('#livegame').html(block); } function loadArticleLive() { jQuery.ajax({url:'http://wbctaiwan.events.pixnet.net/blog/api.php?type=game',dataType:'jsonp',jsonp:'callback',jsonpCallback:'processLiveData'}); } jQuery(document).everyTime(15000, 'none', loadArticleLive).ready(function () { loadArticleLive(); }); </script> </div>