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

    <tfoot id='dXQr0'></tfoot>

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

    <small id='dXQr0'></small><noframes id='dXQr0'>

    1. 带有 getElementByClassName 的 innerHTML 不起作用

      innerHTML with getElementByClassName doesn#39;t work(带有 getElementByClassName 的 innerHTML 不起作用)

      <small id='Uo6pZ'></small><noframes id='Uo6pZ'>

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

                本文介绍了带有 getElementByClassName 的 innerHTML 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                这个有效:

                <td onmouseover="document.getElementById('textbox').innerHTML='Hidden text'" onmouseout="document.getElementById('textbox').innerHTML='Show text'">
                    <div id="textbox">Show text</div>
                </td>
                

                但是这个没有:

                <td onmouseover="document.getElementByClassName('textbox').innerHTML='Hidden text'" onmouseout="document.getElementByClassName('textbox').innerHTML='Show text'">
                    <div class="textbox">Show text</div>
                </td>
                

                我该如何解决这个问题?我需要一个类来多次使用它.

                How can I fix this? I need a class to use it more than once.

                推荐答案

                没有getElementByClassName函数,只有一个getElementsByClassName 一个,因为可以有多个具有给定类的元素.

                There's no getElementByClassName function but a getElementsByClassName one because there can be more than one element with a given class.

                你可以替换

                 document.getElementByClassName('textbox')
                

                 document.getElementsByClassName('textbox')[0]
                

                编辑您的问题:

                此功能在 IE8 上不可用.如果你想在这个浏览器上使用它,你必须添加一个 shim,例如 this question.

                This function isn't available on IE8. If you want to use it on this browser, you must add a shim, such the one which is described in this question.

                这篇关于带有 getElementByClassName 的 innerHTML 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                ChartJS Version 3 - common legend for multiple line charts(ChartJS 版本 3 - 多个折线图的常用图例)
                Charts.js scales yaxes ticks min max doesnt work(Charts.js 缩放 yaxes 刻度 min max 不起作用)
                How to expand the slice of donut chart in chartjs?(如何在chartjs中扩展圆环图的切片?)
                Chart.js yAxes Ticks stepSize not working (fiddle)(Chart.js yAxes Ticks stepSize 不起作用(小提琴))
                Rounded corners on chartJS v.2 - bar charts (with negative values)(chartJS v.2 上的圆角 - 条形图(带负值))
                How to hide value in Chart JS bar(如何在 Chart JS 栏中隐藏值)
                  <bdo id='8OVkP'></bdo><ul id='8OVkP'></ul>
                      <tfoot id='8OVkP'></tfoot>

                      <small id='8OVkP'></small><noframes id='8OVkP'>

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

                        <legend id='8OVkP'><style id='8OVkP'><dir id='8OVkP'><q id='8OVkP'></q></dir></style></legend>
                          <tbody id='8OVkP'></tbody>