Hypergurl Javascripts. Play Sounds on Mouseover of Link. Music on Mouseover of Image.





Handy Tip : Making music play or giving sound as your cursor pointer runs over a link is a good effect for a web page. Keep the sound files short so your visitor gets the effect, as large files take longer to download and your visitor could miss what you are trying to achieve.



Javascript to play sound files on mouseover of link

There are 2 ways to play sound on mouseover. This first way seems to be more reliable than the javascript version.

This is a great javascript which allows you to play different sounds as your visitors runs their mouse over each link or music on mouseover of an image.

Sitemap Run your mouse over the links for an example!

Java Scripts

Paint Shop Pro Tutorials

STEP 1

Place this first part of the script into the body (content) of your page which preloads the sound files.

Substitute the sound files for your own, below the fifth line. The first sound file will be 0, the second 1, the third 2 and so on. You can add as many different sound files as you have links.

STEP 2

Simply add this code into each link, changing the number of the mouseover event to correspond to your sound file.

onMouseOver="playSound(0)" onMouseOut="stopSound(0)"

Your link code should look like this:

<a href="http://www.yourlink.com" onMouseOver="playSound(0)" onMouseOut="stopSound(0)">YOUR LINK</a>

Want to play music on mouseover of an image or object?



The first part of the javascript will be the same. The html code on the image or object will be similar to this:

<img src="yourimage.gif" onMouseOver="playSound(3)" onMouseOut="stopSound(3)">

Have fun!




Search Site
Custom Search





Site design copyright 2000 - 2013 Tanya Puntti Hypergurl.com