Noob Help, easy question
All i want to do is when i click an image i want a sound to play. Ive been looking all over trying everything on the internet and I literally cannot get anything to work i have no idea why. Ive uploaded my sounds and images to my server and ive used the correct directory. Can someone please give me a "for dummies" code and explanation to get this working. (P.S, I have advanced computer skills and ive taken programming in high school i have no idea why im struggling so hard)
image name path on server under the root directory
sound name path on server under root
It depends how you want the audio on your webpage (assuming this is for a website)
the most up to date way (not compatible with legacy browsers) is to use an HTML5 audio tag, a good tutorial can be found here
in the function you can play the audio using html5 media controls, I'm sorry I'd post a code but it's almost time for my next high school class :P
I'll leave you with this to help you though
snagged from https://developer.mozilla.org/en-US/...udio_and_video
<audio id="demo" src="audio.mp3"></audio>
<button onclick="document.getElementById('demo').play()">Play the Audio</button>
<button onclick="document.getElementById('demo').pause()">Pause the Audio</button>
<button onclick="document.getElementById('demo').volume+=0.1">Increase Volume</button>
<button onclick="document.getElementById('demo').volume-=0.1">Decrease Volume</button>
hope that helps!
ok thanks this helps but so far i have the player and the sound. I want the player invisible i tried inserting that display hidden but it didnt work. and then i want it to play when an image is clicked
Try adding a controls="none" attribute to the audio tag
Originally Posted by Thesystem3
Browser has to support HTML5 otherwise you will need a FLASH fall back option.
Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
I laughed that hard I burst my colostomy bag... (\\.\ May03)
Life for some is like a car accident... Mine is like a motorway pile up...
Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)