Play sound on click

Need help? Please give a detailed explanation of your problem.
Post Reply
AubreyB176
Posts: 1
meble kuchenne Mikołów Knurów Czechowice-Dziedzice
Joined: Fri Oct 23, 2015 9:29 am
Website: INFUSEALLY

Play sound on click

Post by AubreyB176 »

I am trying to add a sound on click of an image on my home page, but every time I try to put in a script and save it the script disappears and won't keep it. How do I make sure the sound plays upon click of that image?
User avatar
Paige
Support Team
Support Team
Posts: 461
Joined: Fri Feb 24, 2012 3:41 am
Website: www.allprowebtools.com
Location: Fort Collins, CO
Contact:

Re: Play sound on click

Post by Paige »

The WYSIWYG does not insert html or JS code that is invalid. It does accept all code that is valid however. Can you tell me the JS you are trying to use?

You can also put JS in the footer, valid or not, by going to Settings > Administrator > Theme Editor > Footer.
Infuseally2104
AllPro Expert
AllPro Expert
Posts: 17
Joined: Wed Nov 04, 2015 8:20 am
Website: apwt.infuseally.com

Re: Play sound on click

Post by Infuseally2104 »

Thanks for the feedback Paige. This is the code I'm attempting to put in:

Code: Select all

<a title="Asset Recovery" href="/Asset-Reovery/">
	<img src="/content/uploads/icons/Asset_Recovery.png" alt="Asset Recovery" width="150" height="150" onmouseover="this.src='/content/uploads/icons/Asset_Recovery_g.png';" onmouseout="this.src='/content/uploads/icons/Asset_Recovery.png';" />
</a>
Asset Recovery
</td>
User avatar
Paige
Support Team
Support Team
Posts: 461
Joined: Fri Feb 24, 2012 3:41 am
Website: www.allprowebtools.com
Location: Fort Collins, CO
Contact:

Re: Play sound on click

Post by Paige »

We were not allowing onmouseout and onmmouseover, I have made this possible, please try it again :D
Infuseally2104
AllPro Expert
AllPro Expert
Posts: 17
Joined: Wed Nov 04, 2015 8:20 am
Website: apwt.infuseally.com

Re: Play sound on click

Post by Infuseally2104 »

Thanks for your help Paige. I was able to insert the javascript function into the head of the page, however the editor still won't allow me to put in an onclick call in the link. Any suggestions?
User avatar
Paige
Support Team
Support Team
Posts: 461
Joined: Fri Feb 24, 2012 3:41 am
Website: www.allprowebtools.com
Location: Fort Collins, CO
Contact:

Re: Play sound on click

Post by Paige »

I have added onclick as an accepted element. However I would highly recommend switch your code to jQuery for future browser compatibility, the "onclicks" of the world are being slowly phased out. Here is how you do an onclick in jQuery: https://api.jquery.com/click/
Infuseally2104
AllPro Expert
AllPro Expert
Posts: 17
Joined: Wed Nov 04, 2015 8:20 am
Website: apwt.infuseally.com

Re: Play sound on click

Post by Infuseally2104 »

Thanks for your help Paige. Unfortunately, it's still not working. Is there anything else I can try?
User avatar
Paige
Support Team
Support Team
Posts: 461
Joined: Fri Feb 24, 2012 3:41 am
Website: www.allprowebtools.com
Location: Fort Collins, CO
Contact:

Re: Play sound on click

Post by Paige »

What does you new code look like?
Post Reply