I tried to write it myself. Can you tell me what`s wrong? This is how I call the function (rand) from the html file : a onclick="document.getElementById('player').filename=url+ rand('aaa','bbb','ccc','ddd') +ext" The function itself is in a separate .js file : function rand(q,w,e,r) { var audiofile = new Array(4) audiofile[0] = q audiofile[1] = w audiofile[2] = e audiofile[3] = r var n ...