Image.className

画像(イメージ)オブジェクトのスタイルシートのクラス名を参照/設定します。クラス名はclass属性で指定されたものになります。

構文

画像オブジェクト.className

例文

<html>
 <head>
  <title>Image.className</title>
  <script type="text/javascript"><!--
  window.onload = function() {
   var txt = document.getElementById("myPhoto").className;
   document.getElementById("result").innerHTML = txt;
  }
  // --></script>
 </head>
 <body>
 <a href="#"><img src="photo.gif" id="myPhoto" class="album"></a>
 <div id="result"></div>
 </body>
</html>

関連記事

スポンサーリンク

基本的な特徴

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る