Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 26

Properties

Property accessKey className clientHeight Description Sets or returns an accesskey for an element Sets or returns the class attribute of an element Returns the viewable height of the content on a page (not including borders, margins, or scrollbars) clientWidth Returns the viewable width of the content on a page (not including borders, margins, or scrollbars) dir id innerHTML lang offsetHeight Sets or returns the text direction of an element Sets or returns the id of an element Sets or returns the HTML contents (+text) of an element Sets or returns the language code for an element Returns the height of an element, including borders and padding if any, but not margins offsetLeft Returns the horizontal offset position of the current element relative to its offset container offsetParent offsetTop Returns the offset container of an element Returns the vertical offset position of the current element relative to its offset container offsetWidth Returns the width of an element, including borders and padding if any, but not margins scrollHeight Returns the entire height of an element (including areas hidden with scrollbars) scrollLeft Returns the distance between the actual left edge of an element and its left edge currently in view scrollTop Returns the distance between the actual top edge of an element and its top edge currently in view scrollWidth Returns the entire width of an element (including areas No No No No No No No No Yes Yes Yes Yes No No W3C Yes Yes No

hidden with scrollbars) style tabIndex title Sets or returns the style attribute of an element Sets or returns the tab order of an element Sets or returns the title attribute of an element Yes Yes Yes

Document Object Properties


Property anchors applets body cookie documentMode Description Returns a collection of all the anchors in the document Returns a collection of all the applets in the document Returns the body element of the document Returns all name/value pairs of cookies in the document Returns the mode used by the browser to render the document domain Returns the domain name of the server that loaded the document forms images lastModified links readyState referrer Returns a collection of all the forms in the document Returns a collection of all the images in the document Returns the date and time the document was last modified Returns a collection of all the links in the document Returns the (loading) status of the document Returns the URL of the document that loaded the current document title URL Sets or returns the title of the document Returns the full URL of the document Yes Yes Yes Yes No Yes No Yes Yes W3C Yes Yes Yes Yes No

Anchor Object Properties


W3C: W3C Standard. Property charset href hreflang name rel rev target type Description Sets or returns the value of the charset attribute of a link Sets or returns the value of the href attribute of a link Sets or returns the value of the hreflang attribute of a link Sets or returns the value of the name attribute of a link Sets or returns the value of the rel attribute of a link Sets or returns the value of the rev attribute of a link Sets or returns the value of the target attribute of a link Sets or returns the value of the type attribute of a link W3C Yes Yes Yes Yes Yes Yes Yes Yes

Area Object Properties


W3C: W3C Standard. Property alt coords hash host hostname href noHref pathname Description Sets or returns the value of the alt attribute of an area Sets or returns the value of the coords attribute of an area Sets or returns the anchor part of the href attribute value Sets or returns the hostname:port part of the href attribute value Sets or returns the hostname part of the href attribute value Sets or returns the value of the href attribute of an area Sets or returns the value of the nohref attribute of an area Sets or returns the pathname part of the href attribute value W3C Yes Yes Yes Yes Yes Yes Yes Yes

port protocol search shape target

Sets or returns the port part of the href attribute value Sets or returns the protocol part of the href attribute value Sets or returns the querystring part of the href attribute value Sets or returns the value of the shape attribute of an area Sets or returns the value of the target attribute of an area

Yes Yes Yes Yes Yes

Base Object Properties


W3C: W3C Standard. Property href target Description Sets or returns the value of the href attribute in a base element Sets or returns the value of the target attribute in a base element W3C Yes Yes

Body Object Properties


W3C: W3C Standard. Property aLink background Description Sets or returns the value of the alink attribute of the body element Sets or returns the value of the background attribute of the body element bgColor link text vLink Sets or returns the value of the bgcolor attribute of the body element Sets or returns the value of the link attribute of the body element Sets or returns the value of the text attribute of the body element Sets or returns the value of the vlink attribute of the body element Yes Yes Yes Yes W3C Yes Yes

Button Object Properties


W3C: W3C Standard.

Property disabled form name type value

Description Sets or returns whether a button is disabled, or not Returns a reference to the form that contains a button Sets or returns the value of the name attribute of a button Sets or returns the type of a button Sets or returns the value of the value attribute of a button

W3C Yes Yes Yes Yes Yes

Form Object Properties


Property acceptCharset action enctype length method name target Description Sets or returns the value of the accept-charset attribute in a form Sets or returns the value of the action attribute in a form Sets or returns the value of the enctype attribute in a form Returns the number of elements in a form Sets or returns the value of the method attribute in a form Sets or returns the value of the name attribute in a form Sets or returns the value of the target attribute in a form W3C Yes Yes Yes Yes Yes Yes Yes

Frame/IFrame Object Properties


Note: The Frame/IFrame object can also use the properties/methods of:

The Node object The Element object

W3C: W3C Standard. Property align Description Sets or returns the value of the align attribute in an iframe W3C Yes

contentDocument

Returns the document object generated by a frame/iframe

Yes

contentWindow

Returns the window object generated by a frame/iframe

No

frameBorder

Sets or returns the value of the frameborder attribute in a frame/iframe

Yes

height

Sets or returns the value of the height attribute in an iframe

Yes

longDesc

Sets or returns the value of the longdesc attribute in a frame/iframe

Yes

marginHeight

Sets or returns the value of the marginheight attribute in a frame/iframe

Yes

marginWidth

Sets or returns the value of the marginwidth attribute in a frame/iframe

Yes

name

Sets or returns the value of the name attribute in a frame/iframe Yes

noResize

Sets or returns the value of the noresize attribute in a frame

Yes

scrolling

Sets or returns the value of the scrolling attribute in a frame/iframe

Yes

src

Sets or returns the value of the src attribute in a frame/iframe

Yes

width

Sets or returns the value of the width attribute in an iframe

Yes

Frameset Object Properties


W3C: W3C Standard. Property Description W3C

cols

Sets or returns the value of the cols attribute in a frameset

Yes

rows

Sets or returns the value of the rows attribute in a frameset

Yes

Image Object Properties


W3C: W3C Standard. Property align Description Sets or returns the value of the align attribute of an image W3C Yes

alt

Sets or returns the value of the alt attribute of an image

Yes

border

Sets or returns the value of the border attribute of an image

Yes

complete

Returns whether or not the browser is finished loading an image

No

height

Sets or returns the value of the height attribute of an image

Yes

hspace

Sets or returns the value of the hspace attribute of an image

Yes

longDesc

Sets or returns the value of the longdesc attribute of an image

Yes

lowsrc

Sets or returns a URL to a low-resolution version of an image

No

name

Sets or returns the name of an image

Yes

src

Sets or returns the value of the src attribute of an image

Yes

useMap

Sets or returns the value of the usemap attribute of an image

Yes

vspace

Sets or returns the value of the vspace attribute of an image

Yes

width

Sets or returns the value of the width attribute of an image

Yes

Button Object Properties


W3C: W3C Standard. Property disabled Description Sets or returns whether a button is disabled, or not W3C Yes

form

Returns a reference to the form that contains the input button

Yes

name

Sets or returns the value of the name attribute of an input button

Yes

type

Returns which type of form element the button is

Yes

value

Sets or returns the value of the value attribute of a button

Yes

Checkbox Object Properties


W3C: W3C Standard. Property disabled Description Sets or returns whether a checkbox is disabled, or not W3C Yes

checked

Sets or returns the checked state of a checkbox

Yes

defaultChecked

Returns the default value of the checked attribute

Yes

form

Returns a reference to the form that contains the checkbox

Yes

name

Sets or returns the value of the name attribute of a checkbox

Yes

type

Returns which type of form element the checkbox is

Yes

value

Sets or returns the value of the value attribute of a checkbox

Yes

FileUpload Object Properties


W3C: W3C Standard. Property disabled Description Sets or returns whether the fileUpload button is disabled, or not W3C Yes

accept

Sets or returns a comma-separated list of accepted content types

Yes

form

Returns a reference to the form that contains the FileUpload object

Yes

name

Sets or returns the value of the name attribute of the FileUpload object

Yes

type

Returns which type of form element the FileUpload object is

Yes

value

Returns the path or the name of the selected file

Yes

Hidden Object Properties


W3C: W3C Standard. Property form Description Returns a reference to the form that contains the hidden input field W3C Yes

name

Sets or returns the value of the name attribute of the hidden input field

Yes

type

Returns which type of form element a hidden input field is

Yes

value

Sets or returns the value of the value attribute of the hidden input field

Yes

Password Object Properties


W3C: W3C Standard. Property defaultValue Description Sets or returns the default value of a password field W3C Yes

disabled

Sets or returns whether the password field is disabled, or not

Yes

form

Returns a reference to the form that contains the password field

Yes

maxLength

Sets or returns the maximum number of characters allowed in a password field

Yes

name

Sets or returns the value of the name attribute of a password field

Yes

readOnly

Sets or returns whether a password field is read-only, or not

Yes

size

Sets or returns the width of a password field (in number of characters)

Yes

type

Returns which type of form element a password field is

Yes

value

Sets or returns the value of the value attribute of the password field

Yes

Radio Object Properties


W3C: W3C Standard.

Property checked

Description Sets or returns the checked state of a radio button

W3C Yes

defaultChecked

Returns the default value of the checked attribute

Yes

disabled

Sets or returns whether the radio button is disabled, or not

Yes

form

Returns a reference to the form that contains the radio button

Yes

name

Sets or returns the value of the name attribute of a radio button

Yes

type

Returns which type of form element the radio button is

Yes

value

Sets or returns the value of the value attribute of the radio button

Yes

Reset Object Properties


W3C: W3C Standard. Property disabled Description Sets or returns whether the reset button is disabled, or not W3C Yes

form

Returns a reference to the form that contains the reset button

Yes

name

Sets or returns the value of the name attribute of a reset button

Yes

type

Returns which type of form element the reset button is

Yes

value

Sets or returns the value of the value attribute of the reset button

Yes

Submit Object Properties

W3C: W3C Standard. Property disabled Description Sets or returns whether the submit button is disabled, or not W3C Yes

form

Returns a reference to the form that contains the submit button

Yes

name

Sets or returns the value of the name attribute of a submit button

Yes

type

Returns which type of form element the submit button is

Yes

value

Sets or returns the value of the value attribute of the submit button

Yes

Text Object Properties


W3C: W3C Standard. Property defaultValue Description Sets or returns the default value of a text field W3C Yes

disabled

Sets or returns whether the text field is disabled, or not

Yes

form

Returns a reference to the form that contains the text field

Yes

maxLength

Sets or returns the maximum number of characters allowed in a text field

Yes

name

Sets or returns the value of the name attribute of a text field

Yes

readOnly

Sets or returns whether a text field is read-only, or not

Yes

size

Sets or returns the width of a text field (in number of characters)

Yes

type

Returns which type of form element a text field is

Yes

value

Sets or returns the value of the value attribute of the text field

Yes

Link Object Properties


W3C: W3C Standard. Property charset Description Sets or returns the character encoding of a linked document W3C Yes

href

Sets or returns the URL of a linked document

Yes

hreflang

Sets or returns the language code of the linked document

Yes

media

Sets or returns the media type for the link element

Yes

rel

Sets or returns the relationship between the current document and the linked document

Yes

rev

Sets or returns the reverse relationship from the linked document to the current document

Yes

type

Sets or returns the content type of the linked document

Yes

Meta Object Properties


W3C: W3C Standard. Property content Description Sets or returns the value of the content attribute of a meta element W3C Yes

httpEquiv

Sets or returns an HTTP header for the information in the content attribute

Yes

name

Sets or returns a name for the information in the content attribute

Yes

scheme

Sets or returns how the value of content should be interpreted

Yes

Object Properties
W3C: W3C Standard. Property align Description Sets or returns the alignment of the object according to the surrounding text W3C Yes

archive

Sets or returns a string that can be used to implement your own archive functionality for the object

Yes

border

Sets or returns the border around the object

Yes

code

Sets or returns the URL of the file that contains the compiled Java class

Yes

codeBase

Sets or returns the URL of the component

Yes

codeType

Yes

data

Yes

declare

Yes

form

Returns a reference to the object's parent form

Yes

height

Sets or returns the height of the object

Yes

hspace

Sets or returns the horizontal margin of the object

Yes

name

Sets or returns the name of the object

Yes

standby

Sets or returns a message when loading the object

Yes

type

Sets or returns the content type for data downloaded via the data attribute

Yes

useMap

Yes

vspace

Sets or returns the vertical margin of the object

Yes

width

Sets or returns the width of the object

Yes

Option Object Properties


W3C: W3C Standard. Property defaultSelected Description Returns the default value of the selected attribute W3C Yes

disabled

Sets or returns whether an option is disabled, or not

Yes

form

Returns a reference to the form that contains the option

Yes

index

Sets or returns the index position of an option in a dropdown list

Yes

selected

Sets or returns the value of the selected attribute

Yes

text

Sets or returns the text of an option element

Yes

value

Sets or returns the value to be sent to the server

Yes

Select Object Properties


Property disabled Description Sets or returns whether the dropdown list is disabled, or not W3C Yes

form

Returns a reference to the form that contains the dropdown list

Yes

length

Returns the number of options in a dropdown list

Yes

multiple

Sets or returns whether more than one item can be selected from the dropdown list

Yes

name

Sets or returns the name of a dropdown list

Yes

selectedIndex

Sets or returns the index of the selected option in a dropdown list

Yes

size

Sets or returns the number of visible options in a dropdown list

Yes

type

Returns which type of form element a dropdown list is

Yes

Style object
Syntax for using the Style object properties: document.getElementById("id").style.property="value" The Style object property categories:

Background Border/Outline Generated Content List

Margin/Padding Positioning/Layout Printing Table

Misc

Text

Background properties
W3C: W3C Standard. Property background Description Sets or returns all the background properties in one declaration backgroundAttachment Sets or returns whether a background-image is fixed or scrolls with the page backgroundColor backgroundImage backgroundPosition backgroundRepeat Sets or returns the background-color of an element Sets or returns the background-image for an element Sets or returns the starting position of a background-image Sets or returns how to repeat (tile) a background-image Yes Yes Yes Yes Yes W3C Yes

Border/Outline properties
Property border Description W3C Sets or returns border-width, border-style, and border-color Yes in one declaration borderBottom Sets or returns all the borderBottom* properties in one declaration borderBottomColor borderBottomStyle borderBottomWidth borderColor Sets or returns the color of the bottom border Sets or returns the style of the bottom border Sets or returns the width of the bottom border Sets or returns the color of an element's border (can have up to four values) borderLeft Sets or returns all the borderLeft* properties in one declaration Yes Yes Yes Yes Yes Yes

borderLeftColor borderLeftStyle borderLeftWidth borderRight

Sets or returns the color of the left border Sets or returns the style of the left border Sets or returns the width of the left border Sets or returns all the borderRight* properties in one declaration

Yes Yes Yes Yes

borderRightColor borderRightStyle borderRightWidth borderStyle

Sets or returns the color of the right border Sets or returns the style of the right border Sets or returns the width of the right border Sets or returns the style of an element's border (can have up to four values)

Yes Yes Yes Yes

borderTop

Sets or returns all the borderTop* properties in one declaration

Yes

borderTopColor borderTopStyle borderTopWidth borderWidth

Sets or returns the color of the top border Sets or returns the style of the top border Sets or returns the width of the top border Sets or returns the width of an element's border (can have up to four values)

Yes Yes Yes Yes

outline outlineColor outlineStyle outlineWidth

Sets or returns all the outline properties in one declaration Sets or returns the color of the outline around a element Sets or returns the style of the outline around an element Sets or returns the width of the outline around an element

Yes Yes Yes Yes

Generated Content Properties


Property content Description Sets or returns the generated content before or after the element counterIncrement Sets or returns the list of counters and increment values Yes W3C Yes

counterReset

Sets or returns the list of counters and their initial values

Yes

List properties
Property listStyle Description Sets or returns list-style-image, list-style-position, and liststyle-type in one declaration listStyleImage listStylePosition listStyleType Sets or returns an image as the list-item marker Sets or returns the position of the list-item marker Sets or returns the list-item marker type Yes Yes Yes W3C Yes

Margin/Padding properties
Property margin Description Sets or returns the margins of an element (can have up to four values) marginBottom marginLeft marginRight marginTop padding Sets or returns the bottom margin of an element Sets or returns the left margin of an element Sets or returns the right margin of an element Sets or returns the top margin of an element Sets or returns the padding of an element (can have up to four values) paddingBottom paddingLeft paddingRight paddingTop Sets or returns the bottom padding of an element Sets or returns the left padding of an element Sets or returns the right padding of an element Sets or returns the top padding of an element Yes Yes Yes Yes Yes Yes Yes Yes Yes W3C Yes

Misc properties
Property cssText Description Sets or returns the contents of a style declaration as a string W3C Yes

Positioning/Layout properties
Property bottom clear Description Sets or returns the bottom position of a positioned element Sets or returns the position of the element relative to floating objects clip cssFloat cursor Sets or returns which part of a positioned element is visible Sets or returns the horizontal alignment of an object Sets or returns the type of cursor to display for the mouse pointer display height left maxHeight maxWidth minHeight minWidth overflow Sets or returns an element's display type Sets or returns the height of an element Sets or returns the left position of a positioned element Sets or returns the maximum height of an element Sets or returns the maximum width of an element Sets or returns the minimum height of an element Sets or returns the minimum width of an element Sets or returns what to do with content that renders outside the element box position Sets or returns the type of positioning method used for an element (static, relative, absolute or fixed) right top verticalAlign Sets or returns the right position of a positioned element Sets or returns the top position of a positioned element Sets or returns the vertical alignment of the content in an element visibility width Sets or returns whether an element should be visible Sets or returns the width of an element Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes W3C Yes Yes

zIndex

Sets or returns the stack order of a positioned element

Yes

Printing properties
Property orphans Description Sets or returns the minimum number of lines for an element that must be visible at the bottom of a page pageBreakAfter pageBreakBefore pageBreakInside widows Sets or returns the page-break behavior after an element Sets or returns the page-break behavior before an element Sets or returns the page-break behavior inside an element Sets or returns the minimum number of lines for an element that must be visible at the top of a page Yes Yes Yes Yes W3C Yes

Table properties
Property borderCollapse Description Sets or returns whether the table border should be collapsed into a single border, or not borderSpacing captionSide emptyCells Sets or returns the space between cells in a table Sets or returns the position of the table caption Yes Yes W3C Yes

Sets or returns whether to show the border and background Yes of empty cells, or not

tableLayout

Sets or returns the way to lay out table cells, rows, and columns

Yes

Text properties
Property color direction font Description Sets or returns the color of the text Sets or returns the text direction Sets or returns font-style, font-variant, font-weight, fontsize, line-height, and font-family in one declaration fontFamily Sets or returns the font face for text Yes W3C Yes Yes Yes

fontSize fontSizeAdjust fontStyle

Sets or returns the font size of the text Sets or returns the font aspect value

Yes Yes

Sets or returns whether the style of the font is normal, italic Yes or oblique

fontVariant

Sets or returns whether the font should be displayed in small capital letters

Yes

fontWeight letterSpacing lineHeight quotes

Sets or returns the boldness of the font Sets or returns the space between characters in a text Sets or returns the distance between lines in a text Sets or returns the type of quotation marks for embedded quotations

Yes Yes Yes Yes

textAlign textDecoration textIndent textShadow textTransform unicodeBidi

Sets or returns the horizontal alignment of text Sets or returns the decoration of a text Sets or returns the indentation of the first line of text Sets or returns the shadow effect of a text Sets or returns the case of a text Sets or returns whether the text should be overridden to support multiple languages in the same document

Yes Yes Yes Yes Yes Yes

whiteSpace

Sets or returns how to handle tabs, line breaks and whitespace in a text

Yes

wordSpacing

Sets or returns the spacing between words in a text

Yes

Table Object Properties


Property align Description Sets or returns the alignment of a table according to surrounding text. Use style.textAlign instead W3C D

background

Sets or returns the background image of a table. Use style.background instead

bgColor

Sets or returns the background color of a table. Use style.backgroundColor instead

border

Sets or returns the width of the table border. Use style.border instead

caption

Returns the caption of a table

Yes

cellPadding

Sets or returns the amount of space between the cell border and cell content

Yes

cellSpacing

Sets or returns the amount of space between the cells in a table

Yes

frame

Sets or returns which outer-borders (of a table) that should be displayed

Yes

height

Sets or returns the height of a table. Use style.height instead

rules

Sets or returns which inner-borders (between the cells) that should be displayed in a table

Yes

summary

Sets or returns a description of the data in a table

Yes

tFoot

Returns a reference to the tfoot element of a table

Yes

tHead

Returns a reference to the thead element of a table

Yes

width

Sets or returns the width of the table. Use style.width instead

td/th Object Properties


Note: The TD/TH object can also use the properties/methods of:

The Node object The Element object


W3C: W3C Standard. Property abbr align Description Sets or returns an abbreviated version of the content in a data cell Sets or returns the horizontal alignment of the content in a data cell. Use style.textAlign instead axis background Sets or returns a comma-separated list of related data cells Sets or returns the background image of a data cell. Use style.background instead bgColor Sets or returns the background color of a table. Use style.backgroundColor instead cellIndex ch chOff colSpan headers height noWrap Returns the position of a cell in the cells collection of a table row Sets or returns an alignment character for a data cell Sets or returns the horizontal offset of the ch property Sets or returns the number of columns a cell should span Sets or returns a list of header cell ids for the current data cell Sets or returns the height of a data cell. Use style.height instead Sets or returns whether the content in a cell can be wrapped. Use style.whiteSpace instead rowSpan vAlign width Sets or returns the number of rows a cell should span Sets or returns the vertical alignment of the content within a cell Sets or returns the width of a data cell. Use style.width instead Yes Yes D Yes Yes Yes Yes Yes D D D Yes D W3C Yes D

tr Object Properties
Property Description W3C

align

Sets or returns the horizontal alignment of the content within a table row. Use style.textAlign instead

bgColor

Sets or returns the background color of a table row. Use style.backgroundColor instead

ch

Sets or returns an alignment character for cells in a table row

Yes

chOff

Sets or returns the horizontal offset of the ch property

Yes

height

Sets or returns the height of a table row. Use style.height instead

rowIndex

Returns the position of a row in the rows collection of a table

Yes

sectionRowIndex

Returns the position of a row in the rows collection of a tbody, thead, or tfoot

Yes

vAlign

Sets or returns the vertical alignment of the content within a table row

Yes

Textarea Object Properties


W3C: W3C Standard. Property cols Description Sets or returns the width of a text area W3C Yes

defaultValue

Sets or returns the default value of a text area

Yes

disabled

Sets or returns whether the text area is disabled, or not

Yes

form

Returns a reference to the form that contains the text area

Yes

name

Sets or returns the name of a text area

Yes

readOnly

Sets or returns whether the contents of a text area is read-only

Yes

rows

Sets or returns the height (in rows) of a text area

Yes

type

Returns the type of the form element the text area is

Yes

value

Sets or returns the contents of a text area

Yes

You might also like