Movatterモバイル変換


[0]ホーム

URL:


  1. 開発者向けのウェブ技術
  2. Web API
  3. Document
  4. images

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。

View in EnglishAlways switch to English

Document: images プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2018年6月.

imagesDocument インターフェイスの読み取り専用プロパティで、現在の HTML 文書内の画像集合を返します。

現在の文書内に掲載されているすべての画像の生きたリストを提供するHTMLCollection 。集合の各項目は、単一の画像要素を表すHTMLImageElement です。

使用メモ

返された集合において、集合内のアイテムにアクセスするには、JavaScript の配列記法かitem() メソッドを使用することができます。以下はのものは同等です。

js
firstImage = imageCollection.item(0);firstImage = imageCollection[0];

この例では、画像のリストを見て、"banner.gif" という名前の画像を探します。

js
for (const image of document.images) {  if (image.src === "banner.gif") {    console.log("バナーを見つけました");  }}

仕様書

Specification
HTML
# dom-document-images-dev

ブラウザーの互換性

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp