x
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>idi nahui</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding-top: 50px;
background-color: #222222;
color: rgb(255, 255, 255);
}
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
background-color: #9b0000;
color: rgb(255, 255, 255);
border: none;
border-radius: 5px;
}
button:hover {
background-color: #b13e3e;
}
</style>
</head>
<body>
<h1>idi nahui</h1>
<button id="playButton">idi nahui</button>
<script>
const mp3Files = []
for (let i = 1; i <= 16; i++) {
mp3Files.push(`sounds/${i}.mp3`);
}
const playButton = document.getElementById('playButton');
let lastPlayedIndex = -1;
function playRandomMP3() {
let randomIndex;
do {
randomIndex = Math.floor(Math.random() * mp3Files.length);
} while (randomIndex === lastPlayedIndex);
lastPlayedIndex = randomIndex;
const selectedFile = mp3Files[randomIndex];
const audioPlayer = new Audio(selectedFile);
audioPlayer.play();
}
playButton.addEventListener('click', playRandomMP3);
</script>
</body>
</html>