开发者

How to mute background music in html page

开发者 https://www.devze.com 2023-01-12 08:53 出处:网络
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

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开发者_Python百科 background sound?

Thanks for sharing your time.


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="";

0

精彩评论

暂无评论...
验证码 换一张
取 消