当前位置:首页 > 足球快讯足球快讯
2022年世界杯足球锦标赛:实时比分更新和比赛结果
发布时间:2024-07-24 05:03:12【足球快讯】人次阅读
摘要2022年世界杯足球锦标赛将于2022年11月20日至12月18日在卡塔尔举行,本届赛事是第22届世界杯足球锦标赛,也是首次在中东国家举办,实时比分更新functiongetLiveScores,varrequest=newXMLHttpRequest,request.open,GET,api,live,scores.json...。
2022年世界杯足球锦标赛将于2022年11月20日至12月18日在卡塔尔举行。本届赛事是第22届世界杯足球锦标赛,也是首次在中东国家举办。
实时比分更新
<script type="text/javascript"> function getLiveScores() {var request = new XMLHttpRequest();request.open("GET", "api/live-scores.json", true);request.onload = function() {if (request.status >= 200&& request.status < 400) {var data = JSON.parse(request.responseText);var html = "";for (var match in data) {html += "" + data[match].homeTeam + " " + data[match].homeGoals + " - " + data[match].awayGoals + " " + data[match].awayTeam + "
";}document.getElementById("live-scores").innerHTML = html;}};request.send();}setInterval(getLiveScores, 1000);
</script>
小组赛
<script type="text/javascript"> function getGroupStage() {var request = new XMLHttpRequest();request.open("GET", "api/group-stage.json", true);request.onload = function() {if (request.status >= 200 && request.status < 400) {var data = JSON.parse(request.responseText);var html = "";for(var group in data) {html += "" + group + "
";for (var team in data[group]) {html += "" + data[group][team].name + " " + data[group][team].points + " 分
";}}document.getElementById("group-stage").innerHTML = html;}};request.send();}getGroupStage();
</script>
淘汰赛
<script type="text/javascript"> function getKnockoutRound() {var request = new XMLHttpRequest();request.open("GET", "api/knockout-round.json", true);request.onload = function() {if (request.status >= 200 && request.status < 400) {var data = JSON.parse(request.responseText);var html = "";for (var round in data) {html += "" + round + "
";for (var match in data[round]) {html += "" + data[round][match].homeTeam + " " + data[round][match].homeGoals + " - " + data[round][match].awayGoals + " " + data[round][match].awayTeam + "
";
}}document.getElementById("knockout-round").innerHTML = html;}};request.send();}getKnockoutRound();
</script>
很赞哦! ()