HTML网页中的音乐播放代码

当前目录下有1.MP3 2.MP3 3.MP3 4.MP3 5.MP3
做一个HTML网页,有播放器图形,默认从1.MP3开始循环播放
能上一曲下一曲等

据个人了解
网页中的音乐播放代码有以下几种:
第一种:页面代码中的<head></head>之间加入<bgsound src="音乐url" loop="-1"> 这段代码。 loop指音乐循环的次数,可设置为任意正整数,若设为“-1”的话,音乐将永远循环。

第二种:
在网页代码中的<style></style>标签之间加入一个“Embed”标签,其最简形式就像这样:
<embed src="音乐url" autostart="true" loop="true" width="80" height="20">
不同的是,在这里我们可以设置更多内容,相信内容请看w3scholl手册!
第三种:
使用超链接
例如:<a href="horse.mp3">Play the sound</a>
<script src="http://mediaplayer.yahoo.com/latest"></script>
第四种:
使用 HTML5 <audio> 元素
<audio> 元素是一个 HTML5 元素,在 HTML 4 中是非法的,但在所有浏览器中都有效。
例子:
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
<source src="horse.ogg" type="audio/ogg">
Your browser does not support this audio format.
</audio>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-01-11

所用工具:notepad++

实现网页中播放音乐的用的是html语言中的embed标签。

代码如下:

<embed src="音频文件地址" autostart="true" loop="true" width="100" height="100"> </embed>

HTML中embed插入音频文件相关属性值介绍:

width:宽度
height:高度

autostart:是否自动播放
loop:是否循环
src:文件路径

第2个回答  2008-11-17
http://zhidao.baidu.com/question/6391569.html?fr=qrl&fr2=query
上面这个网页说的是如何加入多个音乐

下面这个代码只能自动循环播放一首音乐
<embed src="1.mp3" autostart="true" loop="true" width="200" height="200"></embed>本回答被提问者采纳
第3个回答  2016-12-20
HTML这个我知到里面可以加音乐播放代码,
解决方案:src=" 3" autostart="true" loop="true" width="200" height="200"></embed>
第4个回答  2019-04-26