当前位置:

实时足球比分:即刻获取最新赛况,掌握比赛动态

来源:24直播网
即刻获取最新赛况

获取最新足球赛况,掌握比赛动态。

日期 时间 主队 客队 比分
<script> // 获取实时足球比分数据const getLiveScores = async () => {const response = await fetch('https://api.football-data.org/v2/matches', {headers: {'X-Auth-Token': 'YOUR_API_KEY'}});const data = await response.json();// 提取比赛数据并填充表格data.matches.forEach(match => {const row = document.createElement('tr');const dateCell = document.createElement('td');dateCell.textContent = match.utcDate.substring(0, 10);row.appendChild(dateCell);const timeCell = document.createElement('td');timeCell.textContent = match.utcDate.substring(11, 16);row.appendChild(timeCell);const homeTeamCell = document.createElement('td');homeTeamCell.textContent = match.homeTeam.name;row.appendChild(homeTeamCell);const awayTeamCell = document.createElement('td');awayTeamCell.textContent = match.awayTeam.name;row.appendChild(awayTeamCell);const scoreCell = document.createElement('td');scoreCell.textContent = match.score.fullTime.homeTeam + ' - ' + match.score.fullTime.awayTeam;row.appendChild(scoreCell);document.querySelector('tbody').appendChild(row);});};// 每 10 秒更新一次数据setInterval(getLiveScores, 10000);// 初始加载数据getLiveScores(); </script>