腾讯体育 NBA直播中心,尽情享受篮球盛宴

來源:24直播网
观看比赛:
腾讯体育 <link href="style.css" rel="stylesheet"/>

直播赛程

日期 时间 主队 客队

正在直播

NBA 新闻

javascript // script.js// 获取赛程数据 const getSchedule = async () => {const response = await fetch('schedule.json');const data = await response.json();return data; };// 填充赛程数据 const populateSchedule = (data) => {const tbody = document.querySelector('live-schedule tbody');data.forEach((game) => {const row = document.createElement('tr');const dateCell = document.createElement('td');const timeCell = document.createElement('td');const homeCell = document.createElement('td');const awayCell = document.createElement('td');dateCell.textContent = game.date;timeCell.textContent = game.time;homeCell.textContent = game.homeTeam;awayCell.textContent = game.awayTeam;row.appendChild(dateCell);row.appendChild(timeCell);row.appendChild(homeCell);row.appendChild(awayCell);tbody.appendChild(row);}); };// 获取新闻数据 const getNews = async () => {const response = await fetch('news.json');const data = await response.json();return data; };// 填充新闻数据 const populateNews = (data) => {const newsFeed = document.querySelector('news-feed ul');data.forEach((article) => {const li = document.createElement('li');const a = document.createElement('a');a.href = article.url;a.textContent = article.title;li.appendChild(a);newsFeed.appendChild(li);}); };// 初始化页面 window.onload = async () => {const schedule = await getSchedule();populateSchedule(schedule);const news = await getNews();populateNews(news); };
更新时间:2025-01-23 13:36:27