1. Home
  2. Computing & Technology
  3. JavaScript

Background Audio

3. Head Script

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Introduction Sample Body Script

The background audio script comes in two parts. The first part is a fixed script that you need to add to the head section of your page. To get this you first need to select the code from the text box below (there is a highlight all button beneath it to make this easier) and then copy it into a file called soundh.js.

You next link this into the head of your page using the following code:

<script type="text/javascript" src="soundh.js">
</script>

Now all that remains is to create the body script that will add your music files and their titles into the selector.

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.