<link href="style.css" rel="stylesheet"/> 實時關(guān)注聯(lián)賽焦點 實時新聞 <script> // 獲取實時新聞數(shù)據(jù)的函數(shù)function getNewsData() {fetch('news.json').then(response => response.json()).then(data => {// 將新聞數(shù)據(jù)添加到新聞列表中data.forEach(news => {const listItem = document.createElement('li');const link = document.createElement('a');link.href = news.url;link.textContent = news.title;listItem.appendChild(link);document.getElementById('news-list').appendChild(listItem);});});}// 獲取排行榜數(shù)據(jù)的函數(shù)function getRankData() {fetch('rank.json').then(response => response.json()).then(data => {// 將排行榜數(shù)據(jù)添加到排行榜列表中data.forEach(rankItem => {const listItem = document.createElement('li');const teamName = document.createElement('span');teamName.textContent = rankItem.team;const win = document.createElement('span');win.textContent = rankItem.win;const lose =document.createElement('span');lose.textContent = rankItem.lose;listItem.appendChild(teamName);listItem.appendChild(win);listItem.appendChild(lose);document.getElementById('rank-list').appendChild(listItem);});});}// 加載頁面時獲取數(shù)據(jù)window.onload = function() {getNewsData();getRankData();}; </script>