DOM:document
出典: MDC
« Gecko DOM リファレンスDOM において、document オブジェクトは HTML, XHTML, そして XML ドキュメントを表す一般的な方法を提供します。document オブジェクトは一般的な DOM Core document インタフェースを備えています。
一般化された DOM Core document インターフェースに加えて、HTML documents もまた、HTML ドキュメント (例えば、document.cookie, document.alinkColor) の処理に対してより特化されたDOM HTMLDocument インタフェースを備えています。プロパティとメソッドの一覧の一部である、より特化されたインタフェースは、その隣にアスタリスク (*) が付きます。
document は window オブジェクトに含まれ、かなり多くの要素を含んでいます。
document インタフェースは、ドキュメントタイプ、その色と形式、プラグインとアプレットなどへのアクセスを提供します。さらに、すべてのドキュメントの子ノード、または BODY や TABLE のような要素を作成し、操作するメソッドを提供します。
目次 |
[編集] プロパティ
- document.alinkColor* 非推奨
- document body 内のアクティブなリンクの色を設定、または返します。
- document.anchors*
- anchors は document 内のすべてのアンカーのリストを返します。
- document.applets*
- applets は document に含まれるアプレットのリスト (出現順) を返します。
- document.baseURIObject Firefox 3 の新機能
- baseURIObject は document の 基底 URI を表す
nsIURIオブジェクトを返します。
- document.bgColor* 非推奨
- bgColor は現在の document の背景色を取得/設定します。
- document.body*
- body は現在の document の BODY ノードを返します。
- document.characterSet
- document に使用されている文字セットを返します。
- document.compatMode*
- document が Quirks モードと Strict モードのどちらで描画されているかを示します。
- document.contentType
- 現在の document の MIME ヘッダから Content-Type を返します。
- document.cookie*
- document の cookie のセミコロンで区切られたリストを返すか、一つの cookie を設定します。
- document.defaultView
- window オブジェクトへの参照を返します。
- document.designMode*
- designMode は Midas による WYSYWIG 編集が可能かどうかを取得/設定します。これは HTML ドキュメントにのみ使用することができます。
- document.doctype
- 現在の document の文書型宣言 (DTD) を返します。
- document.documentElement
- document の直接の子である要素を返します。HTML ドキュメントでは、これは通常の HTML 要素です。
- document.documentURIObject Firefox 3 の新機能
- document の URI の代わりとなる
nsIURIオブジェクトを返します。このプロパティだけは特権 (UniversalXPConnect 特権) を持った JavsScript コード 内で特別な意味を持ちます。
- document.domain*
- domain は現在の document のドメインを返します。
- document.embeds*
- embeds は現在の document に含まれる埋め込まれた OBJECTS のリストを返します。
- document.fgColor* 非推奨
- fgColor は現在の document の前景色または文字色を取得/設定します。
- document.firstChild
- firstChild は document の直接の子のリスト内の最初のノードを返します。(一般的な要素のプロパティは firstChild を参照してください。)
- document.forms*
- forms は現在の document 内の FORM 要素のリストを返します。
- document.height*
- height は現在の document の高さを取得/設定します。
- document.images*
- images は現在の document の画像のリストを返します。
- document.implementation*
- 現在の document に関連付けられた DOM 実装を返します。
- document.lastModified*
- document の最終更新日を返します。
- document.linkColor* 非推奨
- document 内のハイパーリンクの色を取得/設定します。
- document.links*
- document 内のすべてのハイパーリンクのリストを返します。
- document.location*
- 現在の document の URI を返します。
- document.namespaceURI
- 現在の document の XML 名前空間を返します。
- document.nodePrincipal Firefox 3 の新機能
- document の セキュリティコンテキストを表す
nsIPrincipalオブジェクトを返します。
- document.plugins*
- 利用可能なプラグインのリストを返します。
- document.popupNode
- popup が起こされたノードを返します (XML ドキュメントのみ)。
- document.referrer*
- このページへリンクしたページの URI を返します。
- document.styleSheets*
- 現在の document の stylesheet オブジェクトのリストを返します。
- document.title*
- 現在の document のタイトルを返します。
- document.tooltipNode
- 現在の tooltip のターゲットノードを返します。
- document.URL
- 現在の document の URL を含む文字列を返します。
- document.vlinkColor* 非推奨
- 訪問済みのハイパーリンクの色を取得/設定します。
- document.width*
- 現在の document の幅を返します。
[編集] メソッド
- document.clear* 非推奨
- In majority of modern browsers, including recent versions of Firefox and Internet Explorer, this method does nothing.
- document.close*
- Closes a document stream for writing.
- document.createAttribute
- Creates a new attribute node and returns it.
- document.createCDATASection
- Creates a new CDATA node and returns it.
- document.createComment
- Creates a new comment node and returns it.
- document.createDocumentFragment
- Creates a new document fragment.
- document.createElement
- Creates a new element with the given tag name.
- document.createElementNS
- Creates a new element with the given tag name and namespace URI.
- document.createEntityReference
- Creates a new entity reference object and returns it.
- document.createEvent
- Creates an event.
- document.createNSResolver
- Creates an XPathNSResolver.
- document.createProcessingInstruction
- Creates a new processing instruction element and returns it.
- document.createRange
- Creates a Range object.
- document.createTextNode
- Creates a text node.
- document.createTreeWalker
- Creates a
TreeWalkerobject.
- document.elementFromPoint Firefox 3 の新機能
- Returns the element visible at the specified coordinates.
- document.evaluate
- Evaluates an XPath expression.
- document.execCommand*
- Executes a Midas command.
- document.getElementById
- Returns an object reference to the identified element.
- document.getElementsByName
- Returns a list of elements with the given name.
- document.getElementsByTagName
- Returns a list of elements with the given tag name.
- document.getElementsByTagNameNS
- Returns a list of elements with the given tag name and namespace.
- document.importNode
- Returns a clone of a node from an external document.
- document.loadOverlay
- Firefox 1.5 の新機能 Loads a XUL overlay dynamically. This only works in XUL documents.
- document.open*
- Opens a document stream for writing.
- document.queryCommandEnabled*
- Returns true if the Midas command can be executed on the current range.
- document.queryCommandIndeterm*
- Returns true if the Midas command is in a indeterminate state on the current range.
- document.queryCommandState*
- Returns true if the Midas command has been executed on the current range.
- document.queryCommandValue*
- Returns the current value of the current range for Midas command. As of Firefox 2.0.0.2, queryCommandValue will return an empty string when a command value has not been explicitly set.
- document.write*
- Writes text to a document.
- document.writeln*
- Write a line of text to a document.
[編集] イベントハンドラ
Firefox 3 introduces two new events: "online" and "offline". These two events are fired on the <body> of each page when the browser switches between online and offline mode. Additionally, the events bubble up from document.body, to document, ending at window. Both events are non-cancellable (you can't prevent the user from coming online, or going offline). For more info see Online_and_offline_events.
- document.ononline Firefox 3 の新機能
- Returns the event handling code for the online event.
- document.onoffline Firefox 3 の新機能
- Returns the event handling code for the offline event.