网页背景音乐代码

2012-11-07 16:11:49

 

有人在网上发帖问友博网络,如何在网页中插入背景音乐,现在将几种方法列举如下:

将这段代码插入到您的<head></head>之间

当您打开网站时即可听到背景音乐:       

<bgsound src=china.mid loop="-1">

这种当网页最小化之后,音乐会消失

 

网页背景音乐的代码:

<embed src="http://XXX.com/XXX.mp3" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="1" height="1"></embed>

1.mid表示音效文件

<embed src="1.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="1" height="1"></embed>

上面的网页背景音乐代码可以加入FLASH动画的绝对地址(或相对地址)

<embed width=1 height=1 autostart="true" loop="true" controls=PlayButton console=clip1 nolabels=true type="audio/x-pn-realaudio-plugin" src="1.ram"> </embed>

ram格式的音乐文件专用网页背景音乐代码:

<embed src="1.mid" align="center" border="0" width="1" height="1" width="100" autostart="true" loop="true">

指定播放器的大小(width、heigh)、是否自动(autostart标记)、是否循环播放(loop标记),而浏览者则可以自主地决定是否播放音乐。

此代码可以当作网页中插入FLASH动画的代码用。只要把1.mid替换为FLASH动画的相对地址或决对地址就OK了。

<embed src="1.mp3" align="center" border="0" width="1" height="1" width="100" autostart="true" loop="true">

此代码可以加mp3形式的音乐为网页背景音乐

<EMBED src="http://XXX.com/XXX.mp3" width="0" height="0" border=0 autostart="ture" loop="ture"></EMBED>

1.mid表示音效文件

<bgsound src="1.mid" loop=3>

表示将1.mid音效文件插入到页面为背景音乐,并循环播放3次。

<embed src="1.mid" hidden="true">

1.mid表示音效文件

<bgsound src="1.mid" loop="infinte">

1.mid表示音效文件

<embed src="1.mid" hidden="true" loop="true">

1.mid表示音效文件

<bgsound src=1.mid loop="-1">

1.mid表示音效文件