w3resource logo

JavaScript Form Object - encoding property

JavaScript Form Object : encoding Property


Seondary Nav


The encoding property of the form object refers the type of encoding of the form. It is specified in the enctype attribute of the html <form> tag.


Implemented in JavaScript 1.0





Where "myform" is the name of the form in the document.

Example of Form Object : encoding property

In the following web document the encoding property of the form object is used to get the type of encoding.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>JavaScript form Object - encoding property example</title>
<h1 style="color: red">JavaScript form object : encoding  property</h1>
<h3>Clicking the following button you will get the type of encoding of the form.</h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[function filename()
function userEncoding(){
var encodingType = document.form1.encoding;
<form name="form1" action="post" enctype="multipart-data">
<input type="button" value="Get Encoding" onclick='userEncoding()' />

View the example of form object's encoding property in the browser

Supported Browser

Internet Explorer 7 Firefox 3.6 Google Chrome 7 Safari 5.0.1 Opera 10
Yes Yes Yes Yes Yes

See also :

JavaScript Client side objects, methods, properties.

JavaScript Core objects, methods, properties.


Looking for some other tutorial?