| View previous topic :: View next topic |
| Author |
Message |
Hina_Jahr New member

Joined: 06 Jan 2003 Posts: 3
|
Posted: Mon Jan 06, 2003 12:51 pm Post subject: random embeded sound code needed |
|
|
I quite urgently need a piece of code as follows-
A simple ramdom number generater-to determine which of a number of Embeded sounds will be played.
Could anyone help?
cheers |
|
| Back to top |
|
 |
sohnee Senior Member

Joined: 17 Jul 2002 Posts: 2077 Location: UK
|
Posted: Tue Jan 07, 2003 1:53 am Post subject: |
|
|
This is the random number genrator mentioned in Michael's Teach Yourself Javascript book:
| Code: | | var num = Math.floor(Math.random() * 11) + 1; |
You can replace 11 with whatever the maximum random number is that you want.
You could then use the variable "num" to dictate the sound. |
|
| Back to top |
|
 |
Hina_Jahr New member

Joined: 06 Jan 2003 Posts: 3
|
Posted: Tue Jan 07, 2003 12:13 pm Post subject: Question |
|
|
Cheers for that,
Will it work with the <Embed> tag as normal, or willI have to use some way in Javascript to play the sound? |
|
| Back to top |
|
 |
|