足球比分实时更新:不错过任何精彩进球
- 发布于:2025-02-23 14:08:00
- 来源:24直播网

<style>
body {font-family: Arial, Helvetica, sans-serif;}.container {width: 90%;margin: 0 auto;}.header {text-align: center;font-size: 1.5rem;margin-bottom: 1rem;}.table {width: 100%;border-collapse: collapse;}.table th,.table td {border: 1px solid ccc;padding: 0.5rem;}.table th {text-align: center;backgroundrefresh-button" onclick="refreshScores()">刷新比分
<script>// 假数据,用于展示const matches = [{homeTeam: "曼城",awayTeam: "阿森纳",score: "2-1",status: "已完赛"},{homeTeam: "利物浦",awayTeam: "切尔西",score: "0-0",status: "进行中"},{homeTeam: "曼联",awayTeam: "热刺",score: null,status: "未开始"}];let scoresContainer = document.querySelector(".scores tbody");// 刷新比分function refreshScores() {// 清空现有数据scoresContainer.innerHTML = "";// 循环假数据并添加比分行matches.forEach((match) => {// 创建比分行let row = document.createElement("tr");// 创建比赛信息单元格let matchCell = document.createElement("td");matchCell.textContent = `${match.homeTeam} vs ${match.awayTeam}`;// 创建主队比分单元格let homeScoreCell = document.createElement("td");homeScoreCell.textContent = match.score ? match.score.split("-")[0] : "";// 创建比分单元格let scoreCell = document.createElement("td");scoreCell.textContent = match.score;if (match.score) {scoreCell.classList.add(match.status === "已完赛" ? "finished-score" : "live-score");}// 创建客队比分单元格let awayScoreCell = document.createElement("td");awayScoreCell.textContent = match.score ? match.score.split("-")[1] : "";// 创建比赛时间单元格let timeCell = document.createElement("td");timeCell.textContent = "待定";// 将单元格添加到比分行row.appendChild(matchCell);row.appendChild(homeScoreCell);row.appendChild(scoreCell);row.appendChild(awayScoreCell);row.appendChild(timeCell);// 将比分行添加到比分容器scoresContainer.appendChild(row);});}// 每 3 秒刷新一次比分setInterval(refreshScores, 3000);// 初始化比分refreshScores();</script>