Name
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
codeofSYNTAX_ERRif the new value contains a syntax err, or acodeofNO_MODIFICATION_ALLOWED_EXCEPTIONif 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
nullif 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 ...