<i id='kdBX8'><tr id='kdBX8'><dt id='kdBX8'><q id='kdBX8'><span id='kdBX8'><b id='kdBX8'><form id='kdBX8'><ins id='kdBX8'></ins><ul id='kdBX8'></ul><sub id='kdBX8'></sub></form><legend id='kdBX8'></legend><bdo id='kdBX8'><pre id='kdBX8'><center id='kdBX8'></center></pre></bdo></b><th id='kdBX8'></th></span></q></dt></tr></i><div id='kdBX8'><tfoot id='kdBX8'></tfoot><dl id='kdBX8'><fieldset id='kdBX8'></fieldset></dl></div>
    <tfoot id='kdBX8'></tfoot>

      1. <small id='kdBX8'></small><noframes id='kdBX8'>

        <legend id='kdBX8'><style id='kdBX8'><dir id='kdBX8'><q id='kdBX8'></q></dir></style></legend>
          <bdo id='kdBX8'></bdo><ul id='kdBX8'></ul>

      2. 如何在 html 中创建唯一的静音/取消静音按钮(如 youtube)

        How to create a only mute/unmute button (like youtube) in html(如何在 html 中创建唯一的静音/取消静音按钮(如 youtube))

        <tfoot id='KrTpn'></tfoot>

            <tbody id='KrTpn'></tbody>
        • <small id='KrTpn'></small><noframes id='KrTpn'>

            <bdo id='KrTpn'></bdo><ul id='KrTpn'></ul>

              <i id='KrTpn'><tr id='KrTpn'><dt id='KrTpn'><q id='KrTpn'><span id='KrTpn'><b id='KrTpn'><form id='KrTpn'><ins id='KrTpn'></ins><ul id='KrTpn'></ul><sub id='KrTpn'></sub></form><legend id='KrTpn'></legend><bdo id='KrTpn'><pre id='KrTpn'><center id='KrTpn'></center></pre></bdo></b><th id='KrTpn'></th></span></q></dt></tr></i><div id='KrTpn'><tfoot id='KrTpn'></tfoot><dl id='KrTpn'><fieldset id='KrTpn'></fieldset></dl></div>
              • <legend id='KrTpn'><style id='KrTpn'><dir id='KrTpn'><q id='KrTpn'></q></dir></style></legend>

                1. 本文介绍了如何在 html 中创建唯一的静音/取消静音按钮(如 youtube)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在创建一个网站,我放了背景音乐,我的问题是我不知道如何创建一个按钮(只有一个)来静音/取消静音.我想要一个静音按钮,可以根据情况静音/取消静音(如果音乐静音,那么按钮应该有扬声器的图像,用于听到声音,如果按下它,那么你开始听音乐和按钮的图像发生变化,反之亦然)

                  I was creating a website, I put background music, and my problem is I dont know how to create a button(only one) for mute/unmute the sound. I would like to have a mute button that can mute/unmute depending on the situation(if the music is muted then the button should have the image of a Loudspeaker,for hearing the sound, if you press it then you begin listening the music and the image of the button changes and vice versa)

                  我现在拥有的是这样的:

                  what I have now is this:

                  <td width=10% valign="top" align="right">
                                              <img  src="images/sonidoON.png" onclick="this.src='images/sonidoOFF.png'" width=30% height=7%>
                                          </td>
                  

                  我只需要知道如何创建那个按钮,而不是背景音乐的功能.

                  I only need to know how to create that button, not the functions for the background music.

                  非常感谢您

                  推荐答案

                  HTML

                  <input type="checkbox" name="un-mute" id="un-mute">
                  <label for="un-mute" class="unmute">
                      <img src="http://upload.wikimedia.org/wikipedia/commons/3/3f/Mute_Icon.svg" alt="Mute_Icon.svg" title="Mute icon">
                  </label>
                  <label for="un-mute" class="mute">
                      <img src="http://upload.wikimedia.org/wikipedia/commons/2/21/Speaker_Icon.svg" alt="Speaker_Icon.svg" title="Unmute/speaker icon">
                  </label>
                  

                  CSS

                  input#un-mute {
                    display: none;
                  }
                  
                  .unmute img {
                    display: none;
                  }
                  
                  input#un-mute:checked ~ .unmute img {
                    display: initial;
                  }
                  
                  input#un-mute:checked ~ .mute img {
                    display: none;
                  }
                  

                  JavaScript

                  var un_mute = document.getElementById('un-mute');
                  
                  un_mute.onclick = function() {
                     alert('toggle player here');
                  };
                  

                  http://jsfiddle.net/Ffccv/2/

                  使用 :checked 伪类选择器

                  using :checked pseudo-class selector

                  这篇关于如何在 html 中创建唯一的静音/取消静音按钮(如 youtube)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Embed YouTube video - Refused to display in a frame because it set #39;X-Frame-Options#39; to #39;SAMEORIGIN#39;(嵌入 YouTube 视频 - 拒绝显示在框架中,因为它将“X-Frame-Options设置为“SAMEORIGIN)
                  Stop embedded youtube iframe?(停止嵌入 youtube iframe?)
                  YouTube iframe API: how do I control an iframe player that#39;s already in the HTML?(YouTube iframe API:如何控制 HTML 中已有的 iframe 播放器?)
                  Switch/toggle div (jQuery)(切换/切换 div (jQuery))
                  Apply jquery (mobile) css classes programatically after rendering has occurred(呈现后以编程方式应用 jquery (mobile) css 类)
                  How to avoid name clashes in JavaScript widgets(如何避免 JavaScript 小部件中的名称冲突)

                2. <small id='FWGBl'></small><noframes id='FWGBl'>

                    <legend id='FWGBl'><style id='FWGBl'><dir id='FWGBl'><q id='FWGBl'></q></dir></style></legend>

                      <tfoot id='FWGBl'></tfoot>

                          <tbody id='FWGBl'></tbody>
                          • <bdo id='FWGBl'></bdo><ul id='FWGBl'></ul>

                            <i id='FWGBl'><tr id='FWGBl'><dt id='FWGBl'><q id='FWGBl'><span id='FWGBl'><b id='FWGBl'><form id='FWGBl'><ins id='FWGBl'></ins><ul id='FWGBl'></ul><sub id='FWGBl'></sub></form><legend id='FWGBl'></legend><bdo id='FWGBl'><pre id='FWGBl'><center id='FWGBl'></center></pre></bdo></b><th id='FWGBl'></th></span></q></dt></tr></i><div id='FWGBl'><tfoot id='FWGBl'></tfoot><dl id='FWGBl'><fieldset id='FWGBl'></fieldset></dl></div>