Using JavaScript to Add Sound to Your Web Pages ...

(Be patient. The sound file is downloading ...)

JavaScript offers a simple approach to adding sound to your web pages. This sample uses only one sound. If you want to add more sounds you will need to add  additional versions of lines 6, 9 and 10. For an example of a page using several sounds see: ../japanese/animals1.htm

1. <html>
2. <head>
3. <title>
Sample Sound</title>
4. <meta name=
"GENERATOR" content="Microsoft FrontPage 4.0">
5. <script language
="JavaScript">
6. function playSound1() { document.sample.play(); }
7. </script>
8. </head>
9. <embed src=
"sample.wav" name="sample" hidden="true" autostart="false" loop="false" width="0" height="0">
10 <a href=
"javascript:playSound1()"><img border="0" src="sample.gif" width="85" height="90">
11. </html>

(With thanks to Masa Sumura for the sound file)