JavaScript Reference/Javascript Properties/parentNode — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:21, 26 мая 2010
"parentNode" Example
<html>
<body>
<form id="myF">
<input id="myB" type="button" value="Show parent node" onclick="function1();">
</form>
<script language="JavaScript">
function function1() {
var m = document.all.myB.parentNode.id;
alert("Parent node: <form>, id = "+"""+m+""");
}
</script>
</body>
</html>
"parentNode" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <acronym> |
| |<address> <applet> |
| |<area> attribute |
| |<b> <base> |
| |<basefont> <bdo> |
| |<bgsound> <big> |
| |<blockquote> <body> |
| |<br> <button> |
| |<caption> <center> |
| |<cite> <code> |
| |<col> <colgroup> |
| |<comment> <dd> |
| |<del> <dfn> |
| |<dir> <div> |
| |<dl> <dt> |
| |<em> <embed> |
| |<fieldset> <font> |
| |<form> <frame> |
| |<frameset> <head> |
| |<hn> <hr> |
| |<html> <i> |
| |<iframe> <img> |
| |<input type="button"> <input type="checkbox"> |
| |<input type="file"> <input type="hidden"> |
| |<input type="image"> <input type="password"> |
| |<input type="radio"> <input type="reset"> |
| |<input type="submit"> <input type="text"> |
| |<ins> <isindex> |
| |<kbd> <label> |
| |<legend> <li> |
| |<link> <listing> |
| |<map> <marquee> |
| |<menu> <meta> |
| |<noframes> <noscript> |
| |<object> <ol> |
| |<optgroup> <option> |
| |<p> <param> |
| |<plaintext> <pre> |
| |<q> <s> |
| |<samp> <script> |
| |<select> <small> |
| |<span> <strike> |
| |<strong> <style> |
| |<sub> <sup> |
| |<table> <tbody> |
| |<td> <textarea> |
| |textNode <tfoot> |
| |<th> <thead> |
| |<title> <tr> |
| |<tt> <u> |
| |<ul> <var> |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"parentNode" Syntax and Note
Note:
Read-only property.
Returns a reference to the node"s parent node.
Syntax:
document.getElementById("elementID").parentNode
document.all.elementID.parentNode // IE only