RBear Posted August 14, 2015 Share Posted August 14, 2015 Can I use a form selection as a variable on the same page? I want to use the selection to pick an audio. Not working. <form><select name="sermon"> <option value="Runbeach.mp3">Sunday, July 26, 2015 </option> <option value="Bearcreek Blues.mp3">Sunday, July 27, 2015 </option> <option value="Sow 'em On The Mountain.mp3">Sunday, July 28, 2015 </option></select></form> <audio controls> <source src=sermon type="audio/mpeg"> Your browser does not support the audio element.</audio> Link to comment Share on other sites More sharing options...
justsomeguy Posted August 14, 2015 Share Posted August 14, 2015 You can use Javascript to put an event handler on that select element to run a function that gets the value they selected and sets it as the src for the audio source element. The src attribute of the audio source element can't be the name of another element on the page, that doesn't do anything. The src attribute is the URL of a file. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now