Replacing One Image With Another Image
Your Humble Apprentice,
Here is an inline example:
"this" refers to the element that the event was triggered on, so IMG in this case.
<img src="image1.png" onmouseup="this.src = 'image2.png';" alt="" />
Thank you! How could I have been so dumb? For whatever reason I never tried to do it the image...only the <a> tag.
Your code does change the image from the first to the second, but I also was hoping to be able to click it again an it go back to the first...and so on. Is that possible and still achieve the proper function of each button?
You Humble Apprentice,
Before I change things to simply switch between images, are there other buttons that could also influence what state your play button is on.... like a "stop" button?
[Play/Pause] [Stop] [Rewind] [Forward]
Yes. I am just making a simple Play, Pause, and Stop player where the play and pause are in the same place. So...
I have an interesting idea. I'd like your thoughts. I currently use an iframe with my audio element on it. My site runs completely in the iframe. I do this so that my music plays throughout the entire site without having to restart on ever page. Do you think it would be possible to have the player/controller be on my homepage but still be able to control the audio element in the parent iframe?
I really appreciate your help thus far. I've already learned something new...which is why I came here.
I know I've gone a little overboard. If the audio part of your site is event driven, then you can trigger those events with your set of buttons.
Added it as an attachment so you can see the goofy pictures I used as well
Haha! I love them! Let me work on implementing that and I'll let you know if I have any further questions. Thank you so much for your help!
Ok...so here's what I'm thinking. I will create a JS file with one function that contains the <audio> element and additional functions controlling it. I'll call the first function on my iframe and the other functions on my home page. Hopefully that will give me the result I'm looking for.
What do you think?
I really don't know which is better. Personally I try not to use elements like <iframe>.
If you want to keep the music going continuously, you could use AJAX to change the content of your pages instead.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)