Just insert a behavior directly: 1. Learn to add music files. There are generally two ways to add background music to a web page. The first is to add it through the ordinary
(1) Use the
Dreamweaver automatically enters the "〈bgsound" code and press the space bar. The code prompt box will automatically list the attributes of the bgsound tag for you to choose. Use
The bgsound tag*** has five attributes, among which balance is to set the left and right balance of the music, delay is to set the playback delay, loop is to control the number of loops, and src is the number of our music files. Path, volume is the volume setting
Generally when adding background music, we do not need to set the left and right equalization and delay settings for the music, so we only need a few main parameters
The final code is as follows: 〈bgsoundsrc="musicmid"loop="-1"〉 Among them, loop="-1" means that the music plays in an infinite loop. If you want to set the number of playback times, change it to the corresponding number.
This method of adding background music is the most basic method and the most commonly used method. The background music format supports most of the current mainstream music formats, such as WAV, MID, MP3, etc.
p>If you want to take into account browsers with low Internet speeds, you can use MID sound effects as background music for web pages. Because MID music files are small, they can be loaded and played quickly when the web page is opened, but MID There are also shortcomings. It can only store the melody of music, without nice harmonies and lyrics
If your Internet speed is fast, or you feel that MID music is a bit monotonous, you can also add MP3 music< /p>
Just change happymid in the above code to happymp3
Tip: It is more convenient to add background music to FrontPage than Dreamweaver. Just do it in the "Background" dialog box Just set it
(2) Use the
The method of use is basically the same as the first one, except that in the first step of the code prompt box, do not select gbsound, select embed instead
Then select Its attributes are set accordingly (Figure 3). It can be seen from the figure that embed has many more attributes than gbsound's five attributes
The final code is as follows: 〈embedsrc="musicmp3"autostart=" true"loop="true"hidden="true"〉〈/embed〉