HTML Cheat Sheet
HTML Help Forum
Link to us
Adding music to your web page is a great way to keep your visitors coming back for more.
There's many different ways of adding music, but before you go adding music to your web page, your going to need to choose which way best fit's your page.
Here's a few different way's of doing this:
Music that starts automatically
This is a popular one, this code will automatically start playing as soon as one of your visitors opens the page. It also has a stop button on it, which comes in handy when you just donít feel like listening to music, you have the ability to shut it up. To use this on your page just copy and paste the following code where you would like the music button to appear, make sure you change the (yourmididname.mid) with the real music files name:
Seeing this in the browser would look like this:
Now you can edit the code above a few way's:
Automatically Start Playing
If you don't want the music to play automatically, (you want your visitor to have to click play for the music to start) just replace autostart=true with autostart=false. Your whole code will look like this:
Repeating the song
The code above will play your music over and over, non-stop, if you don't want this, (you only want the song to play once, then stop) just replace loop=true with loop=false and repeat=true with repeat=false. Your whole code will look like this:
Creating a Full Media Player
If you notice, the above code creates a small play button (the little square box with the play arrow in it), if you wish to have more, like a pause, stop, and skip track so you can fast forward to different parts of the song, just replace width=25 with width=150 and height=25 with height=45. Doing this will create a consol that looks like this:
Seeing this in the browser will look like this:
Now for even more options, just replace width=25 with width=285 and height=25 with height=45. Your whole code will look like this:
Linking Music Directly
This will allow you to link directly to the music file. This works with mp3's and any other music file as long as your viewer has something to play the file on such as Windows Media Player or Real Player etc... Here's the code:
This does not display any console, it just display's a link to the music file, so when you click on it, it will download the file and automatically start playing it. Looks like this:
If you don't like the text link, you can use an image instead (so you click an image to start playing the music instead of text). To do this just replace the text (Click here to play music) with an image tag that looks like this:
The whole code would look like this:
© 2001 TheHTMlSource.com, INC. All Rights Reserved.