
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Legend form Property
The HTML DOM Legend form property returns the reference of enclosing form for Legend tag.
Syntax
Following is the syntax −
Returning reference to the form object
legendObject.form
Example
Let us see an example for Legend form property −
<!DOCTYPE html> <html> <head> <title>Legend form</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form id="Mid-Term"> <fieldset> <legend id="legendForm">Legend-form</legend> <label for="WeekSelect">Examination Week: <input type="week" value="2019-W36"> </label> <input type="button" onclick="showExamination()" value="What exams are in this week? "> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var legendForm = document.getElementById("legendForm"); function showExamination() { divDisplay.textContent = 'Examinations: '+legendForm.form.id; } </script> </body> </html>
Output
This will produce the following output −
Before clicking ‘What exams are in this week?’ button −
After checking ‘What exams are in this week?’ button −
- Related Articles
- HTML DOM Object form Property
- HTML DOM Textarea form Property
- HTML DOM Form name Property
- HTML DOM Fieldset form property
- HTML DOM Form acceptCharset Property
- HTML DOM Form action Property
- HTML DOM Form autocomplete Property
- HTML DOM Form enctype Property
- HTML DOM Form length Property
- HTML DOM Form method Property
- HTML DOM Form target property
- HTML DOM Select form Property
- HTML DOM Legend Object
- HTML DOM Input URL form Property
- HTML DOM Input Week form Property

Advertisements