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 不起作用

        document.getElementsByTagName not working(document.getElementsByTagName 不起作用)
        <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 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                  SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                  Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)
                  Azure Functions - Import Custom Node Module(Azure Functions - 导入自定义节点模块)

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

                    <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>