如何在html页面中静音背景音乐

发布于 2024-09-14 15:07:15 字数 188 浏览 11 评论 0原文

根据客户的要求,我在网页中添加了背景音乐。我已将音乐设置为循环模式以连续播放。我用过标签来播放音频。这里的问题是如何实现静音按钮,以便客户端可以静音播放的声音。我知道现在播放自动背景音乐是​​个坏主意,但这是客户的要求。该页面是简单的静态 html。

有人知道如何提供静音背景声音的按钮吗?

感谢您分享您的时间。

As per clients requirement, i have added a background music to webpage. I have set the music in loop mode to play it continuous. I have used <BGSOUND> tag to play the audio. The problem here is how to implement mute button so that client can mute the playing sound. I know nowadays its a bad idea to play automatic background music, but its the clients requirement. The page is simple static html.

Do anybody have the idea how to provide button to mute background sound?

Thanks for sharing your time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请恋爱 2024-09-21 15:07:15

确保您的 BGSOUND 设置了 id 属性,那么它应该像设置一样简单
将 src 属性设置为空白:

document.all["bgsound_id"].src="";

Make sure your BGSOUND has it's id attribute set, then it should be as simple as setting
the src attribute to blank :

document.all["bgsound_id"].src="";

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文