即时比分,掌握华球足球每场焦点赛事
【发布时间】:2024-07-16 02:37:11
<link href="style.css" rel="stylesheet"/>
<script>
// 获取实时比分数据const getLiveScores = async () => {const response = await fetch("api/live-scores.json");const data = await response.json();return data;};// 获取焦点赛事数据const getFeaturedMatches = async () => {const response = await fetch("api/featured-matches.json");const data = await response.json();return data;};// 填充实时比分表const populateLiveScores = (data) => {const tableBody = document.querySelector("live-scores tbody");data.forEach((score) => {const row = document.createElement("tr");row.innerHTML = `${score.competition} ${score.homeTeam} ${score.score} ${score.awayTeam} ${score.time} `;tableBody.appendChild(row);});};// 填充焦点赛事列表const populateFeaturedMatches = (data) => {const list = document.querySelector("featured-matches");data.forEach((match) => {const listItem = document.createElement("li");listItem.innerHTML = `${match.homeTeam} vs. ${match.awayTeam}${match.time}`;list.appendChild(listItem);});};// 初始化const init = async () => {const liveScores = await getLiveScores();const featuredMatches = await getFeaturedMatches();populateLiveScores(liveScores);populateFeaturedMatches(featuredMatches);};init();
</script>
- 首页
- 即时比分
- 新闻
- 视频
- 关于我们
即时比分
赛事 | 主队 | 比分 | 客队 | 时间 |
---|