parentNode
親ノードを示します。
構文
オブジェクト.parentNode
例文
<html>
 <head>
  <title>parentNode</title>
  <script type="text/javascript"><!--
  window.onload = function () {
   var pObj = document.getElementById("sub").parentNode;
   document.getElementById("result").innerHTML = pObj.id;
  }
  // --></script>
 </head>
 <body>
 <div id="result"></div>
 <div id="subBlock"><span id="sub">sample</span></div>
 </body>
</html>
関連記事
- previousSibling
- nextSibling
- lastChild
- item
- insertBefore
- hasChildNodes
- getElementsByTagName
- getElementsByName
- getElementById
- firstChild
- createTextNode
- document.createElement
- cloneNode
- childNodes
- appendChild
スポンサーリンク







