<script>
		var alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
		var audio = new Audio();
		var timer1, timer2, timer3;

		function playMP3(file) {
			audio.src = file;
			audio.play();
		}

		function startTest() {
			clearTimeout(timer1);
			clearTimeout(timer2);
			clearTimeout(timer3);
			var i = Math.floor(Math.random() * alphabet.length);
			timer1 = setInterval(function() {
				document.getElementById('test').innerHTML = alphabet[i];
				i = Math.floor(Math.random() * alphabet.length);
			}, 3000);

			timer2 = setTimeout(function() {
				var letter = document.getElementById('test').innerHTML;
				playMP3(letter.toLowerCase() + '.mp3');
			}, 5000);

			timer3 = setTimeout(function() {
				document.getElementById('test').innerHTML = '';
			}, 8000);
		}
	</script
程序员帮我写一个html代码 要求 script		var alphabet = a b c d e f g h i j k l m n o p q r s t u v w x y z;		var audio = new audio;		var timer1 timer2 timer3;		function playmp3file 			audiosrc = file;			audiop

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

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