BGSound is used to insert background music, but only apply to IE, do not apply in Netscape and Firefox, and its parameter is set. . The background music file and path can be set as shown below

SRC = "bjyy.mp3", which can be relative path or absolute path. (You cannot play playlist file)

loop = infinite is repeated playback, loop = 2 indicates twice, you can use -1 to indicate whether it is unlimited

use BGSound settings background music When the window is minimized, the playback is automatically paused, and the window will continue to play.


Setting web page background Method often uses the Embed tag and Object tag

below is the special case of the BGSound minimizes the window:

When BGSound appears within the IFRAME Framework page, if the background music within the frame page is loading or is playing

When the IFRAME framework is removed, the background music continues to play, and the window is minimized after the window is still Play

until the music is naturally played or stopped when the window is closed (not looped).

Regardless of the LOOP property setting of the BGSound tag, music will only play once.

Demo code

Demo code is as follows:


Note: Change the InnerHtml property to occur after the OnLoad event, That is, after the browser completes the load.

Related Articles