
- HTML Home
- HTML Roadmap
- HTML Introduction
- HTML History & Evolution
- HTML Editors
- HTML Basic Tags
- HTML Elements
- HTML Attributes
- HTML Headings
- HTML Paragraphs
- HTML Fonts
- HTML Blocks
- HTML Style Sheet
- HTML Formatting
- HTML Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Frames
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Code Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Table Headers & Captions
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB & RGBA Colors
- HTML - HEX Colors
- HTML - HSL & HSLA Colors
- HTML - HSL Color Picker
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - Document Object Model (DOM)
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Character Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - DOM Document applets Property
HTML DOM document applets property used to return a list of all the applets elements within a document but this property is now deprecated. It returns an empty HTMLCollection in all new web browsers.
The length property of applets collection returned the number of applets element in an HTML document. You can use alternate way getElementsByTagName('applet') to get the same results.
Syntax
document.applets;
Return value
It returns an HTMLCollection object which lists all the <applet> elements present in the document.
Methods
Below table shows a list of methods offered by DOM applets collection.
Methods | Description |
---|---|
[index] | To return the <applet> element from the collection at the given index. Indexing starts from 0 and null is returned if the index is out of bound. |
item(index) | To return the <applet> element from the collection at the given index. Indexing starts from 0 and null is returned if the index is out of range. It is similar to first method. |
namedItem(id) | To return the <applet> element from the collection with the given id. Null is returned if the id doesnt exist. |
Examples of HTML DOM Document 'applets' Property
The following example illustrates uses of appplets property.
Get number of applet Elements
The following example illustrate to get the number of applet element in the document.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML DOM document applets Property</title> </head> <body> <p>Click to get the number of applet element</p> <button onclick="fun()">Click me</button> <p id="applets"></p> <script> function fun() { let x = document.applets.length; document.getElementById("applets").innerHTML = x; } </script> </body> </html>
Alternate way to get number of applet Elements
In this example, getElementsByTagName is used as altrnate way to get the number of of <applet> elements
<!DOCTYPE html> <html lang="en"> <head> <title>HTML DOM document applets Property</title> </head> <body> <applet></applet> <p>Click to get the number of applet element</p> <button onclick="fun()">Click me</button> <p id="applets"></p> <script> function fun() { let num = document.getElementsByTagName("applet").length; document.getElementById("applets").innerHTML = num; } </script> </body> </html>
Get Content of First applet Element
In this example, we will get the content of first <applet> using applets [index] method.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML DOM document applets Property</title> </head> <body> <applet>This is just to show the content of applet tag</applet> <p>Click to get the number of applet element</p> <button onclick="fun()">Click me</button> <p id="applets"></p> <script> function fun() { let num = document.getElementsByTagName("applet")[0].innerHTML; document.getElementById("applets").innerHTML = num; } </script> </body> </html>
Supported Browsers
Property | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
applets | No | No | No | No | No |