如何在JavaScript中使用document.images?

原创
ithorizon 7个月前 (10-19) 阅读数 54 #HTML

使用JavaScript中的 document.images属性来获取文档中标签的数量。

示例

您可以尝试运行以下代码来实现JavaScript中的document.images属性。

实时演示

<!DOCTYPE html>
<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <h1>TutorialsPoint Tutorials</h1>
      <img  src="/javascript/images/javascript-mini-logo.jpg"/ alt="如何在JavaScript中使用document.images?" ><br>
      <img  src="/html5/images/html5-mini-logo.jpg"/ alt="如何在JavaScript中使用document.images?" >
      <script>
         var num = document.images.length;
         document.write("<br>How many images? "+num);
      </script>
   </body>
</html>

以上就是如何在JavaScript中使用document.images?的详细内容,更多请关注IT视界其它相关文章!



热门