HTML 竞猜页面 - 可控制输赢

欢迎来到竞猜页面

请选择你支持的一方:



<script>
	var teamA = 0;
	var teamB = 0;

	function betOnTeamA() {
		teamA++;
		document.getElementById("result").innerHTML = '你支持了A队。';
		checkWinner();
	}

	function betOnTeamB() {
		teamB++;
		document.getElementById("result").innerHTML = '你支持了B队。';
		checkWinner();
	}

	function checkWinner() {
		if (teamA > teamB) {
			document.getElementById("result").innerHTML += 'A队获胜!';
		} else if (teamB > teamA) {
			document.getElementById("result").innerHTML += 'B队获胜!';
		} else {
			document.getElementById("result").innerHTML += '比赛平局!';
		}
	}
</script>
HTML 竞猜页面源码 - 可控制输赢

原文地址: https://www.cveoy.top/t/topic/mY3a 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录