| |||||||||||||||||||
lastChild PropertyDHTML Object Properties DHTML Objects DOM Level 1 Specification. Returns a reference to the last child in the childNodes collection of an object. Syntax
Possible Values
If there is no such node, this property returns null. The property is read-only with no default value. ExampleThe following sample demonstrates the implementation of the lastChild property to obtain the last child element of an object. Click on an element to see.
And this is a paragraph in the DIV. This is a heading in a second DIVAnd this is a blockquote in the second DIV. <div id=div1 onclick="getLast ( this )">
<ul>This is a list in a DIV
<li>
<li>List Item 1
<li>
<li>List Item 2
<li>
<li>List Item 3
</ul>
<p>And this is a paragraph in the DIV.</div>
<div id=div2 onclick="getLast ( this )">
<h3>This is a heading in a second DIV</h3>
<blockquote>And this is a blockquote in
the second DIV.</blockquote></div>
<script language="JavaScript">
function getLast ( objID ) {
var oLast = objID.lastChild;
alert ( 'The lastChild of this DIV is a ' +
oLast.tagName );}
</script>
See AlsofirstChild, nextSibling, previousSibling |
| ||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme