
<style>
body {font-family: Arial, Helvetica, sans-serif;font-size: 14px;color: 333;
background-color: f2f2f2;}h1 {margin-top: 0;font-size: 24px;color: 000;text-align: center;}h2 {font-size: 18px;color: 000;text-align: center;}table {width: 100%;border-collapse: collapse;border: 1px solid cccu003cthead>
比賽時間 | 主隊 | 客隊 | 比分 | 狀態 |
---|
2023-07-01 15:00 | 巴塞羅那 | 皇馬 | 2:1 | 進行中 |
2023-07-02 18:00 | 利物浦 | 曼城 | 0:0 | 未開始 |
2023-07-03 21:00 | 拜仁慕尼黑 | 巴黎圣日耳曼 | 3:1 | 已結束 |
<script>// 定時刷新比分setInterval(function() {$.ajax({url: '/api/match-scores',method: 'GET',success: function(data) {// 更新比分數據for (var i = 0; i < data.length; i++) {var match = data[i];var matchRow = $('match-table tr[data-match-id="' + match.id + '"]');matchRow.find('td:eq(3)').text(match.score);if (match.status === 'live') {matchRow.find('td:eq(4)').text('進行中').addClass('live').removeClass('not-started finished');} else if (match.status === 'finished') {matchRow.find('td:eq(4)').text('已結束').addClass('finished').removeClass('live not-started');} else {matchRow.find('td:eq(4)').text('未開始').addClass('not-started').removeClass('live finished');}}}});}, 1000 30);</script>