
<style>
body {font-family: Arial, Helvetica, sans-serif;margin: 0;padding: 0;}.container {max-width: 1200px;padding: 20px;}.table {width: 100%;border-collapse: collapse;}.table th, .table td {padding: 5px;border: 1px solid ccc;}.table th {text-align: left;}.table tr:nth-child(even) {background-color: eee;}
03e
近期比赛
| 日期 | 时间 | 主队 | 比分 | 客队 |
<script>// 通过 API 获取比赛数据fetch('https://example.com/api/scores').then(response => response.json()).then(data => {// 处理比赛数据const liveScores = data.liveScores;const todayMatches = data.todayMatches;const recentMatches = data.recentMatches;// 更新页面内容document.getElementById('live-scores').innerHTML = liveScores;updateTable(todayMatches, 'today-matches');updateTable(recentMatches, 'recent-matches');});// 更新表格内容function updateTable(matches, tableId) {const table = document.getElementById(tableId);const tbody = table.getElementsByTagName('tbody')[0];for (const match of matches) {const row = document.createElement('tr');const date = document.createElement('td');const time = document.createElement('td');const homeTeam = document.createElement('td');const score = document.createElement('td');const awayTeam = document.createElement('td');date.innerHTML = match.date;time.innerHTML = match.time;homeTeam.innerHTML = match.homeTeam;score.innerHTML = match.score;awayTeam.innerHTML = match.awayTeam;row.appendChild(date);row.appendChild(time);row.appendChild(homeTeam);row.appendChild(score);row.appendChild(awayTeam);tbody.appendChild(row);}}</script>