Menu
I’m trying to turn on a background sound when someone clicks a button. However, the script below turns on the sound when it is clicked, but the page freezes. It’s as if it opens a brand new page with just that sound in its source. Any ideas how I can play a sound when a user clicks something?
[code=php]<script language=”javascript”><!–
function music() {
document.write(“<bgsound src=’url’>”);
}
//–>
</script>
<a href=”http://sound.source.here.soundtype”>init sound</a>
I’ve tried changing href to onClick.
I’ve tried putting that script in <head>.
I’ve tried removing the <!– & //–> comments.
All of the above did not work.