HTML的各种音乐播放方式
来源:互联网 发布:qsv转制软件 编辑:程序博客网 时间:2024/05/17 22:39
1.控制播放和暂停
1
2
3
<
embed
id
=
"soundControl"
src
=
"文件路径及文件"
mastersound
hidden
=
"true"
loop
=
"false"
autostart
=
"false"
></
embed
>
<
input
id
=
"btPlay"
type
=
"button"
value
=
"播放"
onclick
=
"ManageSoundControl('play')"
/>
<
input
id
=
"btStop"
type
=
"button"
value
=
"停止"
onclick
=
"ManageSoundControl('stop')"
/>
1
2
3
4
5
6
7
8
9
10
11
12
function
ManageSoundControl(action)
{
var
soundControl = document.getElementById(
"soundControl"
);
if
(action ==
"play"
)
{
soundControl.play();
}
if
(action ==
"stop"
)
{
soundControl.stop();
}
}
2.JS隐式播放方式:(附带检测)(LOOP代表循环意思)
在页面body里加上
1
2
<bgsound id=
"snd"
loop=
"0"
src=
""
>
<input type=
"button"
value=
"声音"
onclick=
"playSound('这里填写你的声音文件路径')"
>
在<head></head>之间加上
1
2
3
4
5
6
7
8
<script>
function playSound(src){
var _s = document.getElementById(
'snd'
);
if
(src!=
''
&& typeof src!=undefined){
_s.src = src;
}
}
</script>
0 0
- HTML的各种音乐播放方式
- C#播放音乐的5种方式
- 音乐多媒体播放的三种方式
- HTML中播放音乐
- HTML中播放音乐
- HTML中播放音乐
- HTML中播放音乐
- HTML 播放音乐
- html播放音乐代码
- 自己动手开发音乐播放器《六》播放方式的实现
- 网页中插入各种音乐播放器的代码
- HTML教程(8)-播放音乐
- html播放音乐和视频
- HTML Embed 标签播放音乐
- 简单html音乐播放器
- html之音乐播放器
- html音乐播放js/jq
- html一个音乐播放界面
- LOG4J.PROPERTIES配置详解
- LeetCode | Minimum Path Sum
- 乱序存储和顺序存储(堆组织表和索引组织表(IOT))
- Java Collection中List和Set的区别
- 统计素数
- HTML的各种音乐播放方式
- android widget的中文文档 (自译)
- 日志工具类
- [StructLayout(LayoutKind.Sequential)] 是什么意思
- 重装系统后,系统的分辨率始终无法找到合适的
- js添加删除文本框
- 游戏的目的是什么?
- Linux命令行之逗趣无极限
- 一些linux的记录