If you want it to work on all browsers you'll have to use flash I'd start by looking here: http://kolber.github.com/audiojs/ although it seems to not allow for complete custom control I'm sure you could find the native methods in the script that allow you to play a file or what have you. I'm sure there are lots of great options out there, simply google "javascript audio implementation" and you should find lots of great libraries. -Nate
On Sat, Mar 5, 2011 at 10:37 PM, Bryce <[email protected]> wrote: > Hello, > > I'm looking for some help on how to add a sound effect to my current > javascript. I'm using a simple array of quotes to generate a new quote > each time a button is clicked. I'd like to also have an audio clip of > the quote to play in accordance with the text of the quote being > displayed. I'm a noob so I have no idea how to accomplish this. Any > help is greatly appreciated! > > Here's the basic structure of what I'm using now. > > var pullQuote = new Array(5); > > var randomNumber = Math.floor(Math.random() * 5); > > pullQuote[ 0] = "I like Internet Scripting, but it is very hard and > sometimes makes my brain hurt!"; > pullQuote[ 1] = "Internet Scripting is the best course in the DMT > program!"; > pullQuote[ 2] = "Learning JavaScript will help me become a better web > designer!"; > pullQuote[ 3] = "I think JavaScript is for the monkeys!"; > pullQuote[ 4] = "JavaScript makes me go loopy!"; > > var quote = document.getElementById('quote'); > > quote.innerHTML = (pullQuote[randomNumber]); > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
