在 IE 上停止 BGSOUND 元素? [英] Stopping BGSOUND element on IE?

查看:17
本文介绍了在 IE 上停止 BGSOUND 元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我正在构建的网站添加了背景音乐(别杀了我).
而在 IE 中,该元素称为 BGSOUND,我尝试使用一个按钮来暂停
音乐,按钮删除整个元素并重新添加它,但是
原来删除元素只会重新启动 IE 的音乐.

I've added background music to a website i'm building (don't kill me).
Whereas in IE the element is called BGSOUND, I tried to have a button to pause
the music, the button removes the entire element and re-adds it, however
turns out removing the element only restarts the music for IE.

如何通过 javascript 停止 BGSOUND 元素播放的音乐?

How do I stop music being played by the BGSOUND element via javascript?

当前代码:

<!--[if IE]>
    <BGSOUND id="bgmusic" SRC="<?php echo bloginfo('stylesheet_directory'); ?>/bgmusic.mp3" LOOP="true">
<![endif]-->

当我触发命令 document.getElementById('bgmusic').stop()
我得到对象不支持属性或方法停止"

推荐答案

我建议改用 Flash.您不仅可以更好地控制音乐,而且还可以跨浏览器运行.今天,拥有 Flash 播放器的用户比IE.

I suggest using Flash instead. Not only will you have more control over the music, but it will work across browsers too. Today more users have Flash player than IE.

这篇关于在 IE 上停止 BGSOUND 元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆