<script>
// 模拟实时更新比分数据的函数function updateScores() {// 获取比分数据const scores = getScores();// 更新表格中的比分数据const tableBody = document.querySelector('tbody');tableBody.innerHTML = '';scores.forEach(score => {const row = document.createElement('tr');const competitionCell = document.createElement('td');const homeTeamCell = document.createElement('td');const awayTeamCell = document.createElement('td');const scoreCell = document.createElement('td');const timeCell= document.createElement('td');competitionCell.textContent = score.competition;homeTeamCell.textContent = score.homeTeam;awayTeamCell.textContent = score.awayTeam;scoreCell.textContent = score.score;timeCell.textContent = score.time;row.appendChild(competitionCell);row.appendChild(homeTeamCell);row.appendChild(awayTeamCell);row.appendChild(scoreCell);row.appendChild(timeCell);tableBody.appendChild(row);});}// 每隔5秒更新一次比分数据setInterval(updateScores, 5000);
</script>
相关阅读: 500场完整足球比分实时更新 掌握赛事动态