HTML में HTML DOM लीजेंड ऑब्जेक्ट
सिंटैक्स
निम्नलिखित वाक्य रचना है -
एक <किंवदंती> . बनाना तत्व
var legendObject = document.createElement(“LEGEND”)
गुण
यहां, “LegendObject” निम्नलिखित गुण हो सकते हैं -
| संपत्ति | विवरण |
|---|---|
| फ़ॉर्म | यह उस संलग्न फॉर्म का संदर्भ देता है जिसमें लेजेंड तत्व होता है |
उदाहरण
आइए लीजेंड फॉर्म . के लिए एक उदाहरण देखें संपत्ति -
<!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> आउटपुट
यह निम्नलिखित आउटपुट देगा -
‘इस सप्ताह कौन सी परीक्षाएं हैं?’ . पर क्लिक करने से पहले बटन -

जाँच करने के बाद ‘इस सप्ताह कौन सी परीक्षाएँ हैं?’ बटन -
