本站启用国内永久域名: www.LewenSky.cn,请大家使用新域名访问网站!
3月28

背景音乐代码大全

| |
一、单曲播放(背景音乐为一首)
这类代码有:
1、<BGSOUND balance=0 src="http://img.xiaonei.com/photos/20060603/1510/orig51097.wma" volume=-240 loop=infinite><!--背景音乐-->
Volume表示音量,loop=infinite表示循环播放,不停止。这种代码是看不到播放器的。

2、<embed src="http://img.xiaonei.com/photos/20060603/1510/orig51097.wma" hidden="true" autostart="true" loop="true"><!--背景音乐-->
--------hidden="true"表示隐藏播放,即不显示播放器的外观,若要想显示,把"true" 替换为"false"即可,这样为默认是最小化播放,若还想具体显示播放器的大小,另加上height="高度值" width="宽度值" 就可以了。
-------autostart="true"表示当前页一载入则自动播放,若不希望播放改为autostart="false"
即可...
------ loop="true"表示无限次循环播放音乐直到当前页关闭为止,不想循环播放替换为 loop="false"就OK了

3、<embed src="http://img.xiaonei.com/photos/20060603/1510/orig51097.wma" autostart="true" loop="-1" controls="ControlPanel" width="0" height="0" ><!--背景音乐-->
---------loop="-1" 表示无限次循环播放,可设置播放次数,用具体数字代替即可,比如我希望它播放两次,则loop="2"
--------controls="ControlPanel"这个控制选项可省略
--------width="0" height="0"表示隐藏播放,和前面的一样。
若欲设置播放器的外观,则替换为具体的数值就可以了,比如width="123" height="100"

说明:上面的音乐网址都可自行修改,代码可以直接复制,建议将音乐上传到校内网上,这样加载速度快。

二、多首背景歌曲连播,有两种方法
1、使用M3u列表(只能播放Mp3格式的文件)
首先, 新建一个记事本文件(这个要是不会赶紧去学电脑...)
  第二、从网上搜索你喜欢的歌曲,取得网址(一定要是Mp3格式的,其他格式不行),把你找来的MP3地址一个一行排好,一行只能排一个,不得有空行。如:
http://vip.hanzify.org/carlchina/temp/HITFMjh.mp3
http://vip.hanzify.org/carlchina/temp/HITFMjh.mp3
http://vip.hanzify.org/carlchina/temp/HITFMjh.mp3
  就像这样,地址可以无限多,最少一个,然后保存,保存的文件名最好是英文或者数字。

  然后将记事本文件的扩展名.txt改为.M3U,系统会提示改扩展名会导致文件可能不可用,是否继续?点“是”,文件变为M3U了。你也可以将文件另存为.M3U格式。接着你可以打开试听一下效果,如果地址够快的话在你电脑本地就可以进行听歌了。
  最后,把这个M3U文件上传到校内网上,在上传好的文件里点属性,查看地址,将地址(一定是以M3u结尾的网址)贴进一下代码的音乐网址就可以了。
<EMBED src=音乐网址 width=180 height=50 type=audio/mpeg autostart="true" loop="true">
参数可以自己设置,请参照一自己修改。
2、使用ASX列表(不限制音乐格式)
首先新建一个记事本文件,将以下代码输入:
<ASX version ="3.0">
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1720/orig55328.wma"/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1640/orig46257.wma "/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1710/orig52716.wma"/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1720/orig55812.wma "/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1730/orig57023.wma"/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1730/orig57177.wma"/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1640/orig46257.wma"/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1730/orig58026.wma"/>
</Entry>
<Entry>
<Ref href = "http://img.xiaonei.com/photos/20061121/1740/orig58502.wma"/>
</Entry>
</ASX>
然后另存为扩展名为.asx的文件,如music.asx。最后将此文件上传到校内网上,获取文件地址。
将下列代码加入涂鸦板即可:
<embed src="http://img.xiaonei.com/photos/20061121/1740/orig79888.asx" autostart="true" loop="-1" controls="ControlPanel" width="0" height="0" ><!--背景音乐-->
你也可以用上面介绍的方法自行设置参数。
  这种方法,简单、高速、占资源少,且可以播放mp3,wma,asx等多种格式,不必担心有弹出式广告之类。

三、多首歌曲随机播放,只播放一首,但刷新一次,播放一首不相同的歌曲

新建一个记事本文件,将以下代码输入:
<SCRIPT language="javascript">
<!--

var sound1="http://img.xiaonei.com/photos/20061121/1640/orig46257.wma"

var sound2="http://img.xiaonei.com/photos/20061121/1710/orig71630.wma"

var sound3="http://img.xiaonei.com/photos/20061121/1720/orig55328.wma"

var sound4="http://img.xiaonei.com/photos/20061121/1720/orig55812.wma"

var sound5="http://img.xiaonei.com/photos/20061121/1730/orig57023.wma"

var sound6="http://img.xiaonei.com/photos/20061121/1730/orig57177.wma"

var sound7="http://img.xiaonei.com/photos/20061121/1640/orig46257.wma"

var sound8="http://img.xiaonei.com/photos/20061121/1730/orig58026.wma"

var sound9="http://img.xiaonei.com/photos/20061121/1740/orig58502.wma"

var sound10="http://img.xiaonei.com/photos/20061121/1720/orig55328.wma"

var x=Math.round(Math.random()*9)

if (x==0) x=sound1

else if (x==1) x=sound2

else if (x==2) x=sound3

else if (x==3) x=sound4

else if (x==4) x=sound5

else if (x==5) x=sound6

else if (x==6) x=sound7

else if (x==7) x=sound8

else if (x==8) x=sound9

else x=sound10

if (navigator.appName=="Microsoft Internet Explorer")

document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')

else

document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')



//-->
</SCRIPT>

将记事本文件另存为htm网页文件,然后上传到校内网上,获取地址。
在涂鸦板中输入以下代码:
<div id=music><img src="javasc ript:music.innerHTML='<ifr ame src=http://img.xiaonei.com/photos/20061121/2020/orig92674.htm height=0 marginwidth=0 marginheight=0 hspace=0 vspace=0 fr ameborder=0 scrolling=no></ifr ame>'" style=display:none></div><!--背景音乐-->
中间的网址即是你上传的网页地址。
直接复制可能没用,请下载代码。:点击下载


好了,说了这么多了,希望大家有所收获。^_^。

出处:校内网
转载时必须以链接形式注明出处及本声明!


最新日志 随机日志 综合排行
  • OFFICE 2010 VOL...
  • 格式工厂绿色版 V2.90
  • Password Invent...
  • VideoCacheView ...
  • 电脑店U盘启动盘制作工具 3....
  • 阿里旺旺AliIM2011_7...
  • 极点五笔十周年纪念版
  • PPTV网络电视3.1.1.0...
  • WinRAR注册方法
  • 紫光华宇拼音输入法 6.8.0...
  • 本站诚招友情链接(附友情链接要...
  • 腾讯TM2009 Beta 3...
  • BlueScreenView ...
  • 游戏修改大师9.0(Game ...
  • 酷狗音乐2011 V6.216...
  • 射手影音播放器前卫版v3.6....
  • 春哥二三事
  • PPS网络电视(PPStrea...
  • VMware Workstat...
  • PPTV网络电视V2.6.2....
  • 安装软件时出现系统提示&quo...
  • XP与XP无线共享设置(笔记本...
  • ZineMaker目录模板大集...
  • 没有不可能 轻松实现PDG转P...
  • CString转char的方法...
  • [转]MSDN精简版、MSDN...
  • 将IE、FIREFOR (火狐...
  • VC多线程编程(转)
  • MyEclipse6.5下载地...
  • Diskeeper 2010 ...
  • 阅读(2493) | 评论(0) | 引用(0)
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    记住我
    昵称   密码   游客无需密码
    网址   电邮   [注册]