EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

parentNode property

Retrieves the parent object in the document hierarchy.

Syntax

JavaScript

p = object.parentNode

Property values

Type: Object

the parent node.

Standards information

Remarks

The topmost object returns null as its parent.

Examples

This example assigns the parentNode of a span object to a variable.


<script>
  var oParent = oSpan.parentNode;
</script>
  .
  .
  .
<body>
  <span id="oSpan">A Span</span>
</body>

This example assigns the parentNode of a node, created with the createElement method, to a variable.


var oNode = document.createElement("B");
document.body.insertBefore(oNode);
var oParent = oNode.parentNode;

See also

a
abbr
address
area
attribute
b
base
bdo
bgSound
blockQuote
body
br
button
caption
cite
code
col
colGroup
comment
dd
del
dfn
div
dl
documentType
dt
em
embed
fieldSet
form
frame
head
hn
hr
html
i
iframe
img
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
kbd
label
legend
li
link
map
menu
object
ol
option
p
pre
ProcessingInstruction
q
s
samp
script
select
small
span
strong
sub
sup
table
tBody
td
textArea
TextNode
tFoot
th
tHead
title
tr
u
ul
var
About the W3C Document Object Model

 

 

Anzeigen:
© 2014 Microsoft