Click to See Complete Forum and Search --> : Help with music


Creative Name
08-31-2003, 10:03 PM
Could someone help me with the following script?
Right now it says "Error: 'return' statement outside of function"

I have a smaller, revised script a couple posts down, you can check there first if you like

<html>
<head>
<script type="text/javascript">

Array.prototype.random = Joe () ;
{return this[Math.round (Math.random() * Math.ceil (this.length / 10) * 10) % this.length]};

var sound = new Array();
sound[0] = {href:'C:\site\lte_stateofgrace.mp3', title:'State of Grace by: Liquid Tension Experiment'};
sound[1] = {href:'C:\site\lte_freedomofspeech.mp3', title:'Freedom of Speech by: Liquid Tension Experiment'};
sound[2] = {href:'C:\site\mm_icanonlyimagine.mp3', title:'I Can Only Imagine by: Mercy Me'};

var s = sound.random();
document.write('<embed src="s.href', '"hidden="false" autostart="true" nosave="true" width=145 height=55>') ;
document.write('<small class="min">You are listening to:"s.title', '</small>') ;
// -->
</script>
<title>Home</title>

</head>

<body bgcolor="black" link="red" alink="white" vlink="red"
<script language="javascript">
OnLoad="Joe"
</script>
>
</body>
</html>

Thanks

xataku_nakusute
09-01-2003, 02:27 AM
well, im not too sure, but with reguard to your error message.....i would think itd be here perhaps?

{return this[Math.

with much emphasis upon the return

Sux0rZh@jc0rz
09-01-2003, 04:15 AM
<script type="text/javascript">

Array.prototype.random = Joe () ;
{
return this[Math.round (Math.random() * Math.ceil (this.length / 10) * 10) % this.length]
};

should ; be here? ^

Creative Name
09-01-2003, 09:52 AM
thanks for the suggestions guys.
they didn't work though :(
I was fiddlin around with it, I haven't got the music to play yet,
but no errors come up.

here it is


Array.prototype.random = function Joe () {

return this[Math.round (Math.random() * Math.ceil (this.length / 10) * 10) % this.length]


var sound = new Array();
....
}</script>

<body onLoad="Joe ()">