DekGenius.com
Team LiB   Previous Section   Next Section
MediaList a style sheet's list of media types

Availability

DOM Level 2 StyleSheets

Properties

readonly unsigned long length

The length of the array; the number of media types in the list.

String mediaText

A comma-separated text representation of the complete media list. Setting this property may throw a DOMException with a code of SYNTAX_ERR if the new value contains a syntax err, or a code of NO_MODIFICATION_ALLOWED_EXCEPTION if the media list is read-only.

Methods

appendMedium( )

Adds a new media type to the end of the list.

deleteMedium( )

Removes the specified media type from the list.

item( )

Returns the media type at the specified position in the list, or null if the index is invalid. In JavaScript, you can also treat the MediaList object as an array and index it using normal square-bracket array notation instead of calling this method.

Description

This interface represents a list or array of media types for a style sheet. length specifies the number of elements in the list, and item( ) allows a specific media type to be retrieved by position. appendMedium( ) and deleteMedium( ) allow entries to be appended to and deleted from the list. JavaScript allows a MediaList object to be treated as an array, and you can use square-bracket notation instead of calling item( ).

The HTML 4 standard defines the following media types (they are case-sensitive, and must be written in lowercase letters): screen, tty, tv, projection, handheld, print, braile, aural, and all. The screen type is most relevant to documents being displayed in web browsers on desktop or laptop computers. The print type is used for styles intended for printed documents.

See Also

Type of

StyleSheet.media

    Team LiB   Previous Section   Next Section