Add a Web page background music

Source: Internet
Author: User
Tags add format final interface window dreamweaver
Web page | background first, learn to add music files

There are generally two ways to add background music to a Web page, the first one is by using the normal < bgsound> tag, and the other is added by < embed> tags.

(i) Use of < bgsound> labels

With Dreamweaver open the page that needs to add background music, click "Code" to open Code edit view, enter "<" between < body></body> to select Bgsound in the pop-up Code hint box.

Dreamweaver automatically enter the "< Bgsound" code and press the SPACEBAR, the code balloon automatically lists the properties of the BGSOUND tag for you to choose to use. Bgsound label has five properties, of which balance is set music to the left and right balance, delay is the setting of playback delay, loop is the control of the number of cycles, SRC is the path of our music files, volume is the volume settings. In general, when adding background music, we do not need to the music around the balance and delay settings, so only a few major parameters can be. The final code is as follows:

< Bgsound src= "Music.mid" loop= "-1" >

Among them, loop= "-1" means music infinite loop playback, if you want to set the number of playback, then change to the corresponding number.

This method of adding background music is the most basic method, is also the most commonly used method, for the background music format support now most of the mainstream music format, such as WAV, MID, MP3 and so on. If you want to take into account the low speed of the viewer, you can use mid sound as a background music for your Web page, because mid music files are small, so that you can quickly load and play in the process of opening a Web page, but mid also has a shortage of places, it can only store the melody of music, there is no good harmony and lyrics. If you have a fast internet connection, or if you think mid music is a bit monotonous, you can also add MP3 music. Just change the happy.mid in the above code to Happy.mp3.

Hint: It is more convenient to add background music to FrontPage than Dreamweaver, as long as you can set it in the Background dialog box.

(ii) Use of < embed> labels

The use of the < embed> tag to add music is not uncommon, but it's very powerful, and if you combine some playback controls you can create a Web player.

It uses the same method as the first basic, just the first step of the Code hint box do not choose Gbsound, change and choose embed can. And then select its properties for the appropriate settings, you can see that the embed property than the Gbsound five of many properties. The final code follows:< embed src= "Music.mp3" autostart= "true" loop= "true" hidden= "true" ></embed>.

Where Autostart is used to set whether music plays automatically when the page is opened, and hidden sets whether the media player is hidden. Because embed is actually like a music player on a Web page, if it's not hidden, it will show the default media widget for your system.

For these two methods, I think both have advantages and disadvantages: The first method when the page opens music playback, if the page is minimized after the concert automatically paused, if you use the second method does not occur, as long as the window does not close, it will always play. So I hope everyone in the use of the process according to their own circumstances to choose the method of adding music.

Learn the simple way to add a Web page music, you should be in the interface and function up and down a bit. We can use the "Web music player" to create a stylish music player.

Second, create a fashion music player

Learn the simple way to add a Web page music, you should be in the interface and function up and down a bit. We can use the "Web music player" to create a stylish music player.

Tip: "Web music Player" is a Web page plug-in, run the production of a good page, it will call the system's own Windows Media Player to play the pre-set MP3 song.

(a) Simple settings

Download the playback plugin first (download address: http//www.mh.fy.cn/soft/ Music.rar), after decompression into the directory, where Music.htm is that we want to load on the homepage of the play page, list.htm is the viewer used to view playlists pop-up page, JS folder is stored in a number of playback control files, IMG is some of the playback interface picture files.

Using the Web page editing software, open music.htm and locate the following code:

< script language= "Javascript" >

var Blnautostart = True

var blnrndplay = False

var Blnstatusbar = False

var Blnshowvolctrl = True

gn=left> var blnshowplist = True

var Blnusesmi = False

var blnlooptrk = True

var blnshowmminfo =false

</script>

Here you can make Basic settings for the player. The meaning of the above sentence is: whether to play automatically, whether to play sequentially, whether to display the status bar, whether to show the state of sound control, whether to allow the display of playlists, whether to use SMI mode, whether to cycle playback, whether to display song information. You can set them according to your needs, where true is yes and false is no. In addition, in order to make your playlist more personalized, you can also find the < marquee> ......</marquee> statement in the music.htm code, and change the home page name to the name of your own home page.

(ii) Add playlists

Open the playlist file in the JS folder Bglist.js, where you can add your favorite songs to the list, the specific add format for the Mklist "song Path"  "song description" , where "song path" can be you uploaded to the host on the local address, You can also specify the MP3 address on the network, and the "song description" is used to scroll through the play bar, which can be the name of the singer and the song. For example, to add Jay Chou's "Tornado", we first found in the network can play real-time link address, and then add it to the list: Mklist "http://202.102.43.37/hy/yinyue/ Jay Chou/09.mp3"  " Jay Chou--tornado ".

Tip: To keep your home page music often listening to new, we can update the playlist once in a while.

(iii) installation of the player

To prevent the continuity of song playback from clicking on the homepage link, we are going to install the playback page music.htm to the homepage in a frame form.

Take FrontPage 2003 as an example, perform the new → other page template pop-up page Template window, select frames page → footer, and then set the initial page in the previous frame to point to your homepage, The bottom frame points to music.htm, then removes the frame border and adjusts the height of the frame appropriately in the frame properties, which is sufficient to accommodate the height of the bar. After the preview is satisfied you can save the page, and then point your site to the new page on it.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.