添加有播放条的背景音乐:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" contet="text/html;charset=utf-8">
<title>背景音乐设置</title>
</head>
<body>
<audio controls="controls" autoplay="autoplay" loop=-1>
<source src="C:\Users\47688\Desktop\work\dainiqulvxing.mp3" type="audio/mpeg" />
</audio>
</body>
</html>
添加没有播放条的背景音乐:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" contet="text/html;charset=utf-8">
<title>背景音乐设置</title>
</head>
<body>
<div style="display:none";class="music">
<audio controls="controls" autoplay="autoplay" loop=-1>
<source src="C:\Users\47688\Desktop\work\dainiqulvxing.mp3" type="audio/mpeg" />
</audio>
</div>
</body>
</html>
loop的属性为可选属性,当取值为某个数字的时候,就表示背景音乐循环播放该数字所指定的次数;如果取值为-1,则表示循环不断的播放背景音乐;默认情况下,背景音乐只播放一次。