覆盖各大联赛、杯赛,实时更新比分、进球、阵容等详细信息
比赛
-
球队名称
0
VS
0
球队名称
比赛时间
比赛场馆
比赛状态
fixture.scoreHome;const vs = document.createElement('div');vs.classList.add('vs');vs.innerHTML = 'VS';const scoreAway = document.createElement('div');scoreAway.classList.add('score-away');scoreAway.innerHTML = fixture.scoreAway;const teamAway = document.createElement('div');teamAway.classList.add('team-away');teamAway.innerHTML = fixture.awayTeam;const time = document.createElement('div');time.classList.add('time');time.innerHTML = fixture.time;const venue = document.createElement('div');venue.classList.add('venue');venue.innerHTML = fixture.venue;const status = document.createElement('div');status.classList.add('status');status.innerHTML = fixture.status;li.appendChild(teamHome);li.appendChild(scoreHome);li.appendChild(vs);li.appendChild(scoreAway);li.appendChild(teamAway);li.appendChild(time);li.appendChild(venue);li.appendChild(status);fixturesElement.appendChild(li);});}// 更新积分榜信息function updateStandings(standings) {const standingsElement = document.getElementById('standings');standingsElement.innerHTML = '';const table = document.createElement('table');const thead = document.createElement('thead');const tr = document.createElement('tr');const th1 = document.createElement('th');th1.innerHTML = '排名';const th2 = document.createElement('th');th2.innerHTML = '球队名称';const th3 = document.createElement('th');th3.innerHTML = '胜';const th4 = document.createElement('th');th4.innerHTML = '平';const th5 = document.createElement('th');th5.innerHTML = '负';const th6 = document.createElement('th');th6.innerHTML = '积分';tr.appendChild(th1);tr.appendChild(th2);
tr.appendChild(th3);tr.appendChild(th4);tr.appendChild(th5);tr.appendChild(th6);thead.appendChild(tr);table.appendChild(thead);const tbody = document.createElement('tbody');standings.forEach(standing => {const tr = document.createElement('tr');const td1 = document.createElement('td');td1.innerHTML = standing.rank;const td2 = document.createElement('td');td2.innerHTML = standing.teamName;const td3 = document.createElement('td');td3.innerHTML = standing.wins;const td4 = document.createElement('td');td4.innerHTML = standing.draws;const td5 = document.createElement('td');td5.innerHTML = standing.losses;const td6 = document.createElement('td');td6.innerHTML = standing.points;tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);tbody.appendChild(tr);});table.appendChild(tbody);standingsElement.appendChild(table);}// 定时刷新数据setInterval(() => {// 再次 Ajax 请求获取实时数据// 更新比赛信息updateFixtures(fixtures);// 更新积分榜信息updateStandings(standings);}, 10000); // 每 10 秒刷新一次