I thought I had a pretty simple input onclick and script to play a random audio file.
Everything works locally on my system without a problem. Online the code is working on Chrome, Firefox and IE but not Safari. As it works locally on Safari, I'm struggling to find the issue and wondered if anyone could point me in the right direction? There are no error's logged in Safari's Web Inspector either!
<input class="btn btn-primary showPointer" type="button" onclick="getRandomSounds()" value="Play A Clip" />
<script type="text/javascript">
var sounds = new Array();
sounds[0] = "example.mp3";
sounds[1] = "example1.mp3";
function getRandomSounds() {
var randomNum = Math.floor(Math.random()*sounds.length);
document.getElementById("ashboxplayer").src=sounds[randomNum];
}
</script>
The array has been shortened somewhat for this example but there are 80 objects in the array.
Thanks in advance for any light anybody can shed!
Cheers