Pages

Thursday, February 10, 2011

HTML Background Sound Element


The background sound <bgsound> element is used to play a music while the user is browsing your web page. The downside of the background sound <bgsound> element is that it can only be used for  Internet Explorer web browser. If you wish to have a background music that can be played to most web browser, you may use the embed element.

Listed below are the most common attributes you can use for the background sound <bgsound> element:
  • id - provides a unique name for the background sound element.
  • loop - set the number of times the background music should be played. The most common value is "-1" in which it will be played continuously until the web page is unloaded or the web browser is closed.
  • src - provides a Uniform Resource Locator (URL) for the element to be played.
  • volume - sets the volume of the background music. A value of "0" sets the background music in a full volume while a value of "-10,000" sets the background music in zero volume.

Here's an example on how to use the background sound <bgsound> element:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
         <meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
         <mate name="keywords" content="blog, web development" />
         <title>the BACKGROUND SOUND element</title>
     </head>

     <body>
       <h1>
         the BACKGROUND SOUND element
       </h1>
       <bgsound src="mail.wav" loop="-1">
     </body>
  </html>

0 comments:

Post a Comment