top left
The HTML Source Logo


 html
Top Right
    
 Getting StartedHow Do I...TroubleShootingPromotionContact Us
 html
HTML
SEARCH THE SITE
advanced search



CATEGORIES
Home
Getting Started
HTML Cheat Sheet
Webmaster Tools
HTML Help Forum
Color Codes
Link to us









































bottom
HTML HTML HTML HTML
Adding Music



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:

<embed src="yourmidiname.mid" width=25 height=25 autostart=true repeat=true loop=true>

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:

<embed src="yourmidiname.mid" width=25 height=25 autostart=false repeat=true loop=true>


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:

<embed src="yourmidiname.mid" width=25 height=25 autostart=true repeat=false loop=false>


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:

<embed src="yourmidiname.mid" width=150 height=45 autostart=true repeat=true loop=true>

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:

<embed src="yourmidiname.mid" width=285 height=45 autostart=false repeat=true loop=true>

This will create a consol that looks 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:

<a href="YourMidiName.mid">Click here to play music</a>


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:

Click here to play music


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:

<img src="imagegoeshere.gif">


The whole code would look like this:

<a href="YourMidiName.mid"><img src="imagegoeshere.gif"></a>




Company   |   Careers   |   Partners   |   Advertising   |   Help
Privacy Policy   |   Trademark Notices   |   User Agreement
© 2001 TheHTMlSource.com, INC. All Rights Reserved.



Site hosted by Angelfire.com: Build your free website today!