Forward Back

Adding Sound


Home

Advanced HTML
Javascript
The Tools
Promoting the page
Making Money
Contact Me

Adding sound to a webpage is very simple, but you need to do it to support all browsers.

Netscape uses the <embed> tag, like this:

<EMBED SRC="filename.mid" width=145 height=60 
autostart=false hidden=false loop=true volume=50>
  • SRC- the filename of the sound file
  • Autostart- True/False, whether or not the sound starts when the page is loaded.
  • hidden- True/False, whether the controls are hidden or not.
  • loop- True/False, whether or not the sound repeats after it is finished.
  • Height/Width- These should be kept at 60 and 145, otherwise the controls will look bad.
  • Controls- put controls="smallconsole" for a smaller control box. Use Height=15 and Width=53 with this:

Notice that you can't see the play button, this is fixed if it's set to autostart.

For Internet Explorer, you have to add the bgsound tag inside the body tag, like this:

<body bgsound="filename.mid">

The safest way to add sound is to creat a link to the sound file:
Want some music?
Which is done like this: <A href="filename.mid">Want some music?</A>

Mail me at tkeer@cvn.net.

1