Click to See Complete Forum and Search --> : Sounds


Andy Newhouse
10-28-2003, 06:57 AM
Not sure if you can help but here goes, I created this line of code to make a sound when a link is hovered over and when a link is clicked, seems to work ok on normal links but not on my back button, here the code for a normal link



<p align="center"><b><font size="4" face="Algerian" color="#0000FF">

<a target="mainFrame" href="MainPage.htm" onMouseOver="playSound(0)" onClick="playSound(1)" style="text-decoration: none">Home</a></font></b></p>



that works ok



but this doesn’t



p align="center"><font face="Algerian" size="4">

<A

href="javascript:history.back()" onMouseOver="playSound(0)" onClick="playSound(1)" style="text-decoration: none; font-weight:700">Go back</A></font></p>



the difference is the javascript bit which makes it go back a page. The hover sound works but not the on click, can anyone help.

gil davis
10-28-2003, 11:55 AM
The HREF action executes before the onclick can make the sound. Try this instead:
<A href="#" onMouseOver="playSound(0)" onClick="playSound(1);history.back();return false" style="text-decoration: none; font-weight:700">
If that doesn't work, try this:
<A href="#" onMouseOver="playSound(0)" onClick="playSound(1);setTimeout('history.back()',200);return false" style="text-decoration: none; font-weight:700">

Andy Newhouse
10-28-2003, 12:09 PM
Thanks i used the bottom one and it worked fine, didnt try the first one as i tried to move onclick to front without the delay and that didnt work but i didnt do it the same as you so first one may have worked better than my attempt. but thanks for help now working as i required.