1. <tfoot id='miDTC'></tfoot>

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

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

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

        使用替代文本查找图像标签

        时间:2023-09-08
      3. <small id='wLH8f'></small><noframes id='wLH8f'>

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

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

              <tfoot id='wLH8f'></tfoot>
                  <legend id='wLH8f'><style id='wLH8f'><dir id='wLH8f'><q id='wLH8f'></q></dir></style></legend>

                • 本文介绍了使用替代文本查找图像标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想知道是否可以使用 Javascript 通过其 alt 文本查找图像标签.例如我有这个标签: <img src="Myimage.jpg" alt="Myimage"> 有没有办法通过查找Myimage"alt 属性来获取标签?

                  I would like to know if it was possible using Javascript to find an image tag by its alt text. For instance I have this tag: <img src="Myimage.jpg" alt="Myimage"> would there be a way to obtain the tag by looking for the "Myimage" alt attribute?

                  推荐答案

                  毫无疑问,很快就会有 jQuery 解决方案发布.要做到这一点,以下将起作用:

                  There will undoubtedly be a jQuery solution posted soon enough. To do it without, the following will work:

                  function getImagesByAlt(alt) {
                      var allImages = document.getElementsByTagName("img");
                      var images = [];
                      for (var i = 0, len = allImages.length; i < len; ++i) {
                          if (allImages[i].alt == alt) {
                              images.push(allImages[i]);
                          }
                      }
                      return images;
                  }
                  
                  var myImage = getImagesByAlt("Myimage")[0];
                  

                  这篇关于使用替代文本查找图像标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在纯 HTML 属性中使用 JSF EL 下一篇:setAttribute 和 setAttributeNS(null,

                  相关文章

                  最新文章

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

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

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

                    1. <tfoot id='WeU3M'></tfoot>