Home  >  Article  >  Web Front-end  >  How to use document.images in JavaScript?

How to use document.images in JavaScript?

WBOY
WBOYforward
2023-08-19 15:49:021061browse

How to use document.images in JavaScript?

Use the document.images property in JavaScript to get the number of How to use document.images in JavaScript? tags in the document.

Example

You can try running the following code to implement the document.images property in JavaScript.

Real-time demonstration

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

The above is the detailed content of How to use document.images in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete