"."/> ".">

Home >Web Front-end >HTML Tutorial >What is the html tag for adding background music?

What is the html tag for adding background music?

藏色散人
藏色散人Original
2020-11-16 10:42:5511118browse

The html tag for adding background music is c13e0c5c6d6db5040172f3e526aa994e. 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 "312386385a542e51bcfa174aec264117".

What is the html tag for adding background music?

##Recommended: "

HTML Video Tutorial"

The html tag for adding background music is c13e0c5c6d6db5040172f3e526aa994e.

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 312386385a542e51bcfa174aec264117

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 tags

The 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 playing

When 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=&#39;sound<bgsound src="http://clearsky.gougou.cc/xiaonei/music.asp" loop="-1">&#39;;
bgmusic.document.body.innerHTML=bghtml;
document.all.bgmusic.removeNode();
}
</script>

Notes for editing

Note: 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn