error in the script

admin

Administrator
Staff member
This javascript work not correct - where is the error?
=========================
<html>
<head>
<script language=JavaScript>
<!--
function randomSound()
{
var sound_array = new Array();
sound_array[0] = "1.wav";
sound_array[1] = "2.wav";
sound_array[2] = "3.wav";
sound_array[3] = "4.wav";
sound_array[4] = "5.wav";
sound_array[5] = "6.wav";
sound_array[6] = "7.wav";
sound_array[7] = "8.wav";
var rndm_sound = Math.round(Math.random()*sound_array.length);
open(sound_array[rndm_sound],"mysound","");
}
// -->
</script>
</head>
<body>

<font OnClick="document.all.music.src='randomSound()'">
<b>Play a Random Sound</b></font>


</body>
</html>
 
Back
Top