11.3 Using Sound on a Web Page^431
the standard code. The solution (located in the student files Chapter11/music.html
folder) is shown below.
<object data="soundloop.mp3" height="50" width="100"
type="audio/mpeg"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
type="audio/mpeg" >
Browsers render in a top-down line-by-line fashion. Only Internet Explorer understands
the conditional comments. In this case, the conditional comment indicates that Internet
Explorer should ignore the code within the comments. The conditional comment begins
with and ends with . So, Internet Explorer
will render the first
HANDS-ON PRACTICE 11.2
In this Hands-On Practice you will create a Web page that displays a controller to play
a sound (see Figure 11.3). If you have not done so already, copy the music.mp3 or
music2.mp3 sound file from the Chapter11 folder in the student files and save it to
disk. Launch Notepad or another text editor and create a Web page that contains the
heading Playing Sounds with the Object Tag and uses the
tag to display a console that lets the Web page visitor control the audio file. Use the
sample code above and the list of attributes and values in Table 11.1 and Table 11.2 as
a guide. Experiment with the
50, 100, and 110 and notice how the display of the controller changes. Explore the
element’s autoplayvalue to configure the sound to automatically play
when the page loads. Use the element’s loopvalue to cause the sound to
loop continuously. Save your page as object.html and test it in a browser. Try to test
your page in different browsers and browser versions. Compare your work to the sam-
ple in the student files (Chapter11/object.html).