firefox和ie中播放背景音乐
来源:互联网 发布:日本铁路里程知乎 编辑:程序博客网 时间:2024/05/01 17:19
在IE中播放背景音乐,可以用bgsound
简单的语句如下:
<bgsound src="3.mp3" loop="-1" id="soundctl">
其中src指的是设置或获取要播放的声音的 URL.(Sets or retrieves the URL of a sound to play)
loop指的是设置或获取声音或视频剪辑在激活时的循环播放次数 值为-1时指的是无限次播放.值为0时播放一次.值为其它数值时播放的次数为设置的数值.它的缺省值为1次.
id为获取标识对象的字符串.
如果控制播放能否停止,如下语句:
if(document.getElementById("soundctl").src!=""){
document.getElementById("soundctl").src=""
}else{
document.getElementById("soundctl").src="3.mp3"
}
bgsound在firefox中没有作用,所以要用到embed,简单语句如下:
<embed name="onlineCallSound"
src="images/msg.mp3"
loop=false
autostart=true
type=audio/mpeg mastersound
hidden=true
width=0
height=0>
</embed>
我用的是Firefox/3.0.5,并且装了iTunesSetup插件,很奇怪的是设置了hidden=true后,背景音乐不响,所以只能将width=0 ,height=0,把loop设为true的话,背景音乐只能响一次,所以我设置了playcount="9999",所以写出的语句如下:
<embed src="<%=request.getContextPath()%>/Video/3.wma"
width="0"
height="0"
playcount="9999"
autostart="true"
id="soundctl">
</embed>
控制播放的js如下:
dosound.src = $("#soundctl").get()[0].src;
dosound.soundctl = $("#soundctl").get()[0];
function dosound(){
with(dosound){
if(src!=""){
soundctl.pause();
src="";
}else{
src = getCurrent()+"/Video/3.wma";
soundctl.play();
}
}
}
可以在IE,FIREFOX中实现背景音乐的播放,但是FIREFOX中却不能实现音乐的控制!
简单的语句如下:
<bgsound src="3.mp3" loop="-1" id="soundctl">
其中src指的是设置或获取要播放的声音的 URL.(Sets or retrieves the URL of a sound to play)
loop指的是设置或获取声音或视频剪辑在激活时的循环播放次数 值为-1时指的是无限次播放.值为0时播放一次.值为其它数值时播放的次数为设置的数值.它的缺省值为1次.
id为获取标识对象的字符串.
如果控制播放能否停止,如下语句:
if(document.getElementById("soundctl").src!=""){
document.getElementById("soundctl").src=""
}else{
document.getElementById("soundctl").src="3.mp3"
}
bgsound在firefox中没有作用,所以要用到embed,简单语句如下:
<embed name="onlineCallSound"
src="images/msg.mp3"
loop=false
autostart=true
type=audio/mpeg mastersound
hidden=true
width=0
height=0>
</embed>
我用的是Firefox/3.0.5,并且装了iTunesSetup插件,很奇怪的是设置了hidden=true后,背景音乐不响,所以只能将width=0 ,height=0,把loop设为true的话,背景音乐只能响一次,所以我设置了playcount="9999",所以写出的语句如下:
<embed src="<%=request.getContextPath()%>/Video/3.wma"
width="0"
height="0"
playcount="9999"
autostart="true"
id="soundctl">
</embed>
控制播放的js如下:
dosound.src = $("#soundctl").get()[0].src;
dosound.soundctl = $("#soundctl").get()[0];
function dosound(){
with(dosound){
if(src!=""){
soundctl.pause();
src="";
}else{
src = getCurrent()+"/Video/3.wma";
soundctl.play();
}
}
}
可以在IE,FIREFOX中实现背景音乐的播放,但是FIREFOX中却不能实现音乐的控制!
- firefox和ie中播放背景音乐
- 兼容IE-FireFox-Chrome的背景音乐播放
- 兼容IE-FireFox-Chrome的背景音乐播放
- 兼容IE、FireFox等跨浏览器播放背景音乐 html
- Spritekit中播放背景音乐
- 游戏中背景音乐循环播放
- Cocos2d-x中播放背景音乐
- htm背景音乐播放和停止
- javascript在IE和Firefox中兼容性问题
- FireFox和IE 中 Ajax 同步执行
- jsonStore在firefox和ie中兼容性问题
- cursor在IE和firefox中兼容
- javascript在IE和Firefox中兼容性问题
- IE和Firefox中JS区别
- 播放背景音乐
- 背景音乐播放
- 背景音乐播放
- 背景音乐播放
- 今后还要继续!
- GnuCash是什么?
- verilog 编程新得
- 铁路售票系统的安全解决方案
- Perl中的子例程
- firefox和ie中播放背景音乐
- javascript支持区号输入的省市二级联动下拉菜单
- 什么是营销型网站?
- 白话Oracle的连接和会话的区别(Connection/Session)
- cn域名注册活动结束通知,国际域名降价了
- ORA-06553: PLS-221: 'HASH_SH1' 不是过程或尚未定义的原因和解决方案
- Linux与Windows下的Java开发对比
- NET分层开发思想与小笼包的联想
- 2009年1月江西IDC服务商排名报告