Javascript examples for DOM HTML Element:Form
The acceptCharset property sets or gets the accept-charset attribute in a form element.
Set the acceptCharset property with the following Values
Value | Description |
---|---|
character-set | A space- or comma-separated list of one or more character encodings that are to be used for the form submission. |
Common values:
A String, representing the character set(s) that the server should use for form submission
The following code shows how to return the character-set the server should use for form submission:
<!DOCTYPE html> <html> <body> <form id="myForm" accept-charset="ISO-8859-1"> First name: <input type="text" name="fname" value="Donald"><br> Last name: <input type="text" name="lname" value="Duck"><br> </form>/* w w w .j av a 2s . c o m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var v = document.getElementById("myForm").acceptCharset; document.getElementById("demo").innerHTML = v; } </script> </body> </html>