1. Home
  2. Computing & Technology
  3. JavaScript

Background Audio

4. Body Script

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Introduction Sample Head Script

The final step is to generate the Javascript to go into the body of your page where you want the background audio selector to appear. You will need to generate this script using the form below in order to specify the sound files (and corresponding titles) that you want to use on your site. Just enter details of one of your audio files into the form and press the "Add Audio" button then repeat the process for the next file and so on until you have entered all of the audio files that you want to add. If you make a mistake you can either just re-enter the details and delete the two lines generated by the mistaken entry after you are done or refresh the page to start over again from the beginning.

Sound File:
Title:
This music is either my own original work (written by, played by, and recorded by me), or I have the permission of all persons who hold rights to the music to broadcast this version of their music in public.
Body Script

The final step is save this as soundb.js (or another name if you prefer) and then link it into the body of your page where you want the selector to appear using the following code:

<script type="text/javascript" src="soundb.js">
</script>
Explore JavaScript
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.