Image nameプロパティ
Image オブジェクト
定義と使い方
name プロパティは、画像の名前を設定または返します。
構文
imageObject.name=name
ブラウザ対応
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザが name プロパティをサポートしています。
例
例
画像の名前を返す:
<html>
<body>
<img id="compman" name="compman"
src="compman.gif.html" alt="Computerman" width="107" height="98">
<br>
<script>
document.write("Image name: ");
document.write(document.getElementById('compman').name);
</script>
</body>
</html>
<body>
<img id="compman" name="compman"
src="compman.gif.html" alt="Computerman" width="107" height="98">
<br>
<script>
document.write("Image name: ");
document.write(document.getElementById('compman').name);
</script>
</body>
</html>
試してみる »
Image オブジェクトその他の拡張機能