Uncle Jim's Web Designs - JavaScript Examples

Play Sounds on Mouseover and Click

Author: Jim Stiles


This script attaches an onMouseover or onClick sound event to links, playing WAV files.
When you move your mouse over the text, a WAV file is played.

First, you need to preload and assign your sound files to the events by placing the following script between the head tags:

COPY - Insert Between Head Tags: <HEAD></HEAD>


Next, you need to assign a particular sound file event to your links:
MY HOME PAGE | JAVASCRIPT EXAMPLES | MICROSOFT OFFICE TIPS | ON-LINE GAMING SITE

COPY - Insert Inside Body: <BODY></BODY>


You can also set it to play onClick, as in the below example:
Click here to play sound

COPY - Insert Inside Body: <BODY></BODY>


Or, you can create a button to play a sound, like the example below:


COPY - Insert Inside Body: <BODY></BODY>


Or, you can create an image file to play a sound, like the example below:



COPY - Insert Inside Body: <BODY></BODY>





Close This Window