JavaScript ने फॉर्म के accept-charset और enctype प्राप्त करने के लिए document.acceptCharset और document.enctype प्रदान किए हैं। आइए उन्हें व्यक्तिगत रूप से चर्चा करें।
Accept-Charset
उदाहरण
निम्न उदाहरण में, एक फॉर्म को प्रारंभ में accept-charset के साथ प्रदान किया गया है और DOM प्रॉपर्टी document.acceptCharset का उपयोग करके वह accept-charset मान आउटपुट में दिखाए अनुसार प्रदर्शित किया जाता है।
<html> <body> <form id="form1" accept-charset="ISO-8800-7"></form> <p id="char"></p> <script> var cha = document.getElementById("form1").acceptCharset; document.getElementById("char").innerHTML = cha; </script> </body> </html>
आउटपुट
ISO-8800-7
Enctype
उदाहरण
निम्न उदाहरण में, फॉर्म का enctype document.enctype DOM कमांड का उपयोग करके प्रदर्शित किया गया है। फॉर्म को name, target, आदि जैसे enctype का मान प्रदान करने की कोई आवश्यकता नहीं है। किसी भी फॉर्म में एक इनबिल्ट enctype होगा।
<html> <body> <form id="form1" name="form" action="/action_page.php"></form> <p id="type"></p> <script> var ty = document.getElementById("form1").enctype; document.getElementById("type").innerHTML = ty; </script> </body> </html>
आउटपुट
application/x-www-form-urlencoded