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

    2. <legend id='RJpV6'><style id='RJpV6'><dir id='RJpV6'><q id='RJpV6'></q></dir></style></legend>

          <bdo id='RJpV6'></bdo><ul id='RJpV6'></ul>
        <tfoot id='RJpV6'></tfoot>

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

        document.getElementsByTagName 不起作用

        时间:2023-07-31
        <legend id='Z1qUq'><style id='Z1qUq'><dir id='Z1qUq'><q id='Z1qUq'></q></dir></style></legend>

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

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

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

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

                  问题描述

                  我想使用 document.getElementsByTagName('input')根据需要设置(或取消设置)输入列表.有可能吗?

                  I would like to use document.getElementsByTagName('input') to set as required (or unset it) for a list of inputs. is it possible?

                  我试过了:

                  document.getElementsByTagName('input').required = false;
                  

                  或(用于不同的目的)

                  document.getElementsByTagName('input').value = ""
                  

                  但它似乎不起作用.

                  此外:是否可以捕获某种类型的输入(即文本或广播)?

                  Moreover: is it possible to catch a certain type of input (i.e. text or radio)?

                  谢谢!!!ObOnKen

                  Thank you!!! ObOnKen

                  推荐答案

                  getElementsByTagName() 返回一个元素集合,所以你需要遍历集合...

                  getElementsByTagName() returns a collection of elements so you need to iterate over the collection...

                  var elements = document.getElementsByTagName('input');
                  
                  for(var i = 0; i < elements.length; i++)
                  {
                      if(elements[i].type == "text")
                      {
                          elements[i].value = "";
                      }
                  }
                  

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

                  上一篇:&gt; 之间的区别或"/&gt;在 HTML 中 下一篇:使用 jsdoc 记录匿名对象和函数的最佳方式

                  相关文章

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

                    <tfoot id='KlLIw'></tfoot>

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

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

                    • <bdo id='KlLIw'></bdo><ul id='KlLIw'></ul>