Forum Moderators: open
The next question is how to generate a sound when a link is clicked. Here are some things I've tried so far:
<A HREF="foo.htm" onClick="playsound()">
<A HREF="JavaScript:Play-Sound-And-Wait-Before-Changing-Page()">
<A HREF="foo.htm" onClick="return false; Play-Sound-And-Wait-Before-changing-Page()">
<A HREF="foo.htm" onClick="return PlaySound()">
Any other ideas?
Yep, I am worried about spider friendliness. I also think that a growing number of people are surfing with JavaScript turned off (such as me :)) because of the chronic number of popup ads plaguing the net. So purely JavaScript links aren't the best way to go.
I've had a little success with this one.:
<SCRIPT>
function go-to-foo() {
window.setTimeout('window.location="foo.htm"','1000'));
}
document.write('<A HREF="JavaScript:playsound();go-to-foo()">
</SCRIPT>
<NOSCRIPT><A HREF="foo.htm"></NOSCRIPT>Click here</A>
Works fine in MSIE, but...
- Nesting error may trip up some browsers or spiders.
- You can't put a quote inside a quote inside a quote, so none of the functions in HREF can have arguments.
- No sound comes out with NN4.7 (possibly the original Codebrain script, possibly because I'm running it locally)
- Fails miserably in Opera. GetRight butts in, and the link is no longer clickable...
I'm still working on it, but if anyone has any good ideas, I'm all ears!