item

オブジェクトの子ノードを示します。item()で指定する以外にchildNodes配列を使って指定することもできます。

構文

オブジェクト.childNodes.item(参照番号)
オブジェクト.childNodes[参照番号]

例文

<html>
 <head>
  <title>item</title>
  <script type="text/javascript"><!--
  function changeText() {
   document.getElementById("result").childNodes.item(0).nodeValue = "New Text !!";
  }
  // --></script>
 </head>
 <body>
 <div id="result">Sample</div>
 <form>
  <input type="button" value="Change Text" onClick="changeText()">
 </form>
 </body>
</html>

関連記事

スポンサーリンク

UNION演算子 和集合を計算する

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

上に戻る