Creating a clickable link to an embedded sound in your page.

Click the image

Refresh the page to stop it playing

Put the javascript code in between the head tags on your page.

The following bold code goes between your head tags:

<head>
<title> My Site</title>

<script>
function EvalSound(soundobj) {
var thissound= eval("document."+soundobj);
thissound.Play();
}
</script>


</head>

The following bold code goes in your page after the body tag:

<body>

<embed src="father.mp3" autostart=false width=0 height=0 name="sound1"
enablejavascript="true">

This is the code I have for my image link.
<a href="#" onClick="EvalSound('sound1')"><img src="play.gif"></a>

If you want to use a text link rather than an image.

<a href="#" onClick="EvalSound('sound1')"> click here</a>

Both the sound file and the image (both in red) are in the same folder as my page.

Home | HTML Help | Resources | Useful Links | Contact us