Section 62. Add Sounds to Your Page

62. Add Sounds to Your Page

BEFORE YOU BEGIN

25 Add Text and Graphics to the Page


SEE ALSO

57 Add a Picture to Your Page

60 Add a Flash Animation to Your Page

61 Add a Video to Your Page


Adding sounds to your page can be done a few different ways. For the most part, there are sounds that you can play when the page opens at load time. Other sounds can be played when you link to them.

There are loads of sites with music on them on the Web. A quick search should find several sites with free sounds to download and use for this task. I am using a file called klaxon.wav as an example.

62. Add Sounds to Your Page


1.
View the HTML Code of a Test File

Open a test page, put your cursor at the beginning of the page and select HTML Code from the Insert menu.

2.
Enter a Background Sound

In the text area, add the following code and press OK . I am using klaxon.wav. Be sure to type your sound file's name in its place.

<BGSOUND src="klaxon.wav" loop="infinite">

The <BGSOUND> tag sets a background sound for the page when it loads. The SRC attribute points to a sound file for the tag to use. Setting the loop to "infinite" means that the clip is going to play over and over. (I recommend against playing any sounds over and over, by the way ‚ .)

You can try this technique with either WAV files or MP3 files.

You might want to note that the <BGSOUND> tag doesn't work on all browsers. Test this line with your favorite browser. If it doesn't work, search your browser's online help for information on this browser directive.

3.
Enter Text to Link to a Sound File

Create a new row of cells in which to work. Click in the first cell of the new row and enter text to create a link to connect to a sound file.

Enter some text that you can use for a link. In my case, I am going to link to an MP3 file of my chickens talking, typical inane celebrity gossip at that.

4.
Create the Link

Highlight the text you just created and right-click on the text to select Make Link from the context menu.

In the Link Properties dialog box, enter the name of your sound file to which you want to link and click OK .

5.
View Your Page (and Listen to the Music)

Save your file and preview it in a browser. As always, check your typing (and your sound volume levels). You might even want to double-click on the copy sound file that is on your PC. This will test whether the sound file is corrupted and whether this sound file format is supported by your technology.



Sams Teach Yourself Creating Web Pages All in One
Sams Teach Yourself Creating Web Pages All in One
ISBN: 0672326906
EAN: 2147483647
Year: 2006
Pages: 276

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net