Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Adding Music on rollover

  • 07-01-2011 07:48PM
    #1
    Registered Users, Registered Users 2 Posts: 63 ✭✭


    Hi all

    Im looking for an easy way of adding a music clip on rollover of an image using dreamweaver and i can't find any videos or useful tutorials anywhere

    any suggestions?


Comments

  • Registered Users, Registered Users 2 Posts: 3,579 ✭✭✭BopNiblets


    This seemed to work for me in FF only though.
    <script language="javascript" type="text/javascript">
     function playSound(soundfile) {
     document.getElementById("dummy").innerHTML=
     "<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
     }
     </script>
    
    <img src="playmusic.jpg" alt="Play music" onmouseover="playSound('music.mp3');">
    <span id="dummy"></span>
    


  • Closed Accounts Posts: 7,221 ✭✭✭BrianD


    You should check out if there are royalty payments required for the use of the music.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Also note that the above may cause a lag while the mp3 in question loads, which might spoil the effect.

    P.S. I'd hope this isn't for a key navigation element or something, and is for something specific where the user would expect a sound ? Because otherwise it would be extremely irritating, particularly if the sound restarts every time you roll over a navigation element.


Advertisement