Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











PROPERTY:  Object::firstChild

Object  Attr   CDATASection   CharacterData   Comment   DocumentFragment   DocumentType   Entity   EntityReference   Node   Notation   ProcessingInstruction   Text
 
Object.firstChild

The firstChild property is read-only and returns the first child of a given node. If there is no first child, or the node is of a type that cannot have child nodes (see the DOM Structure Model), then it returns null.

The example that follows obtains the text of the first child node of the root element of the 'states.xml' file.

XML:
<States>
   <State ref="FL">
      <name>Florida</name>
      <capital>Tallahassee</capital>
   </State>
   <State ref="IA">
      <name>Iowa</name>
      <capital>Des Moines</capital>
   </State>
</States>

Code (JavaScript):
var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("states.xml");

var f_child = xml_doc.documentElement.firstChild.text;
document.write(f_child);

Output:
Florida Tallahassee



 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information