15 out of 27 rated this helpful - Rate this topic

type attribute | type property

[This documentation is preliminary and is subject to change.]

Retrieves or initially sets the type of input control represented by the object.

HTML 4.01 Specification, Section 17.4

Syntax

HTML<element type="p" ... >
JavaScript

p = object.type

Property values

Type: String

One of the input control values in Possible Values.

button

Creates a button control.

checkbox

Creates a check box for simple Boolean attributes or for attributes that can take multiple values at the same time. The input consists of a number of check box controls, each of which has the same name. Each selected check box generates a separate name/value pair in the submitted data, even if this results in duplicate names. The default value is on.

file

Creates a file upload object.

hidden

Creates a control hidden from the user, but the value of the value property is sent with the submitted form.

image

Creates an image control that can be clicked, causing the form to be immediately submitted. The coordinates of the selected point are measured in pixels from the upper-left corner of the image and are submitted with the form as two name/value pairs. The x-coordinate is submitted under the name of the control with .x appended, and the y-coordinate is submitted under the name of the control with .y appended. Any value property is ignored. The image is specified by the src property, exactly as for the img object

password

Creates a control similar to the text control, except that text is not displayed as the user enters it.

radio

Creates radio buttons used for mutually exclusive sets of values. Each radio button control in the group should be given the same name. Only the selected radio button in the group generates a name/value pair in the submitted data. Radio buttons require an explicit value property.

reset

Creates a button that resets the form's controls to their specified initial values. You can specify the label to display on this button just as you can for the Submit button.

submit

Creates a button that submits the form. Use the value attribute to specify a label that is displayed on the button. The default label is application-specific. When the button is clicked, the associated control objects submit name/value pairs to the server.

text

Default. Creates a single-line text-entry control. Use the value in conjunction with the size and maxLength properties.

Standards information

Remarks

Only the type property is writeable.

As of Microsoft Internet Explorer 5, the type property is read/write-once, but only when an input element is created with the createElement method and before it is added to the document.

 

 

Build date: 3/8/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
IE is broken..
Until type can be rewritten.
I must recommend against using IE until it's fixed :)
Please fix IE so that it behaves reasonably.  There's waaaaaaay more than just this idiocy.
I must recommend against using IE until type writing is fixed
Please update IE to allow type writing - always. I must continue recommending users to alternate browers.
Same question here
Apparently that comment above is going to be around awhile too without a response. I would actually like to know the same thing as dilbertvsr would. If type is no longer read-only, we should be able to manipulate it, right?

Since there doesn't appear to be a date/time stamp on these comments, I will add one:
2:16pm June 1, 2009

[tfl - 03 06 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at 
http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&
write-once

What's the rationale for write-once? In DOM level 2, the type attribute is no longer read-only. DOM2 has been around since 2003 ...

[tfl - 03 06 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at 
  http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&