Link and onclick sound event
Hello all, very specific problem for you all. I'm trying to add an onclick event to play a clicking sound when a link is clicked.
Using this code http://webdesign.about.com/od/sound/...sound_oncl.htm
I've followed all the instructions properly, and yes it works fine onclick when the href is blank only.
I think you are right - as soon as the link is clicked then the page redirects and the playSound() function is not called.
But why do you want to annoy your visitors in this way? It adds no value whatever to be required hear a sound when a link is clicked. Some people listen to music while they ae surfing - your click sounds will ensure they do not visit your site again.
If you are really determined to do this, then do the redirect after the sound:-
<a href="#" onclick="playSound('button.wav'); redirectToIndexPage()">HOME</a>
or call redirectToindexPage() at the end of the playSound() function, perhaps with a short time delay.
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
Yes, I assumed as much. And technically this is not a website for me. It was a request for a site that I finished sometime ago, they wanted me to add this, if it were up to me, I would leave it as is with no sounds.
Usually am able to fix all my own problems, but I've never actually added onclick sounds, (because of the excellent reasoning that you gave and that I agree with) hence why I was a bit stumped looking for a workaround. I might just let them know it's a bad idea.
|All times are GMT +1. The time now is 04:34 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.