The html tag for adding background music is . bgsound is used to insert background music, but it is only applicable to IE. It is not applicable to netscape and firefox. Its parameter settings are very few. The syntax is as follows "".
##Recommended: "
HTML Video Tutorial"
The html tag for adding background music is
. bgsound is used to insert background music, but it is only applicable to IE and not applicable to netscape and firefox. Its parameter settings are very few. As follows src="bjyy.mp3" sets the background music file and path, which can be a relative path or an absolute path. (Playlist files cannot be played) loop=infinite Whether to automatically repeat playback, LOOP=2 means repeating twice, you can use -1 to mean repeating infinitely Use bgsound to set the background music, when Playback will be automatically paused when the window is minimized, and playback will continue when the window is restored. Commonly used methods when setting web page background music include using embed tags and object tagsThe following is a special case where bgsound continues to play when the window is minimized:When bgsound appears When in an iframe page, if the background music in the frame page is loading or playingWhen the iframe is removed, the background music will still continue to play, and it will still play after the window is minimized
Stop until the music finishes playing naturally or the window is closed (it will not loop). No matter how the loop attribute of the bgsound tag is set, the music will only play once.
The demo code is as follows:
<iframe id=bgmusic width=30 height=20></iframe>
<script language=javascript>
function window.onload(){
var bghtml='sound<bgsound src="http://clearsky.gougou.cc/xiaonei/music.asp" loop="-1">';
bgmusic.document.body.innerHTML=bghtml;
document.all.bgmusic.removeNode();
}
</script>
Copy after login
Notes for editingNote: Changing the innerHTML attribute can only be done after the onload event occurs, that is, in the browser After completing the loading of the object. The above is the detailed content of What is the html tag for adding background music?. For more information, please follow other related articles on the PHP Chinese website!