Home >Web Front-end >HTML Tutorial >How do I get document.embeds to work in JavaScript?

How do I get document.embeds to work in JavaScript?

PHPz
PHPzforward
2023-09-04 11:13:061035browse

How do I get document.embeds to work in JavaScript?

Use the document.embeds property in JavaScript to get the number of tags in the document.

Example

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

Real-time demonstration

<!DOCTYPE html>
<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <embed src = "/html/yourfile.mid" width = "250" height = "100" />
      <script>
         var num = document.embeds.length;
         document.write("<br>How many embed tags: "+num);
      </script>
   </body>
</html>

The above is the detailed content of How do I get document.embeds to work 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