javascriptÖÐDOM½Úµã
nodeName
nodeName ÊôÐÔº¬ÓÐij¸ö½ÚµãµÄÃû³Æ¡£
ÔªËØ½ÚµãµÄ nodeName ÊDZêÇ©Ãû³Æ
ÊôÐÔ½ÚµãµÄ nodeName ÊÇÊôÐÔÃû³Æ
Îı¾½ÚµãµÄ nodeName ÓÀÔ¶ÊÇ #text
Îĵµ½ÚµãµÄ nodeName ÓÀÔ¶ÊÇ #document
×¢ÊÍ£ºnodeName Ëù°üº¬µÄ XML ÔªËØµÄ±êÇ©Ãû³ÆÓÀÔ¶ÊÇ´óдµÄ
nodeValue
¶ÔÓÚÎı¾½Úµã£¬nodeValue ÊôÐÔ°üº¬Îı¾¡£
¶ÔÓÚÊôÐԽڵ㣬nodeValue ÊôÐÔ°üº¬ÊôÐÔÖµ¡£
nodeValue ÊôÐÔ¶ÔÓÚÎĵµ½ÚµãºÍÔªËØ½ÚµãÊDz»¿ÉÓõġ£
nodeType
×÷ ÓÃ
±æÊ¶½ÚµãµÄDOM ÐÍ̬¡£ ¡¡
»ù±¾Óï·¨
numNodeType £½ xmlDocNode.nodeType ;
¡¡
˵ Ã÷
´ËÊôÐÔÖ»¶ÁÇÒ´«»ØÒ»¸öÊýÖµ¡£
ÓÐЧµÄÊýÖµ·ûºÏÒÔϵÄÐͱð£º
1-ELEMENT (ÔªËØ)
2-ATTRIBUTE £¨ÊôÐÔ£©
3-TEXT £¨Îı¾£©
4-CDATA
5-ENTITY REFERENCE
6-ENTITY
7-PI (processing instruction)
8-COMMENT £¨×¢ÊÍ£©
9-DOCUMENT £¨£©
10-DOCUMENT TYPE
11-DOCUMENT FRAGMENT
12-NOTATION
¡¡
¡¡
·¶ Àý
numNodeType £½ xmlDoc.documentElement.nodeType;
alert(numNodeType);
Node Types
½ÚµãÀàÐÍ
The following table lists the different W3C node types, and which node types they may have as children:
ÏÂÊö±í¸ñÁоÙÁ˲»Í¬µÄW3C½ÚµãÀàÐÍ£¬Ã¿¸ö½ÚµãÀàÐÍÖпÉÄÜ»á°üº¬×ÓÀࣺ
Node type
½ÚµãÀàÐÍDescription
ÃèÊöChildren
×ÓÀà
Document
Îĵµ
Represents the entire document (it is the root-node of the DOM tree)
¶¨ÒåÕû¸öÎĵµ£¨DOMÊ÷µÄ¸ù½Úµã£©
Element (max. one), ProcessingInstruction, Comment, DocumentType
DocumentFragment
ÎĵµÆ¬¶Ï
Represents a "lightweight" Document object, which can hold a portion of a document
¶¨Òå“lightweight”Îĵµ¶ÔÏ󣨱£ÁôÒ»¸öÎĵµÖеÄÒ»²¿·Ö£©
Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
DocumentType
ÎĵµÀàÐÍ
Represents a list of the entities that are defined for the document
¶¨ÒåÎĵµµÄʵÌåÁбí
None
EntityReference
ʵÌå²ÎÊý
Represents an entity reference
¶¨ÒåÒ»¸öʵÌå²ÎÊý
Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
Element
ÔªËØ
Represents an element
¶¨ÒåÒ»¸öÔªËØ
Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference
Attr
ÊôÐÔ
Represents an attribute. Not
Ïà¹ØÎĵµ£º
ÕâÁ½ÌìÉÏÎçÒ»Ö±ÔÚѧϰJavaScript£¬ÓÉÓÚ×ÜÊÇÔÚ¿´£¬Ð§¹û²»ÊǺܴó£¬Ò²ºÃ¾ÃûÓз¢±íÎÄÕÂÁË£¬ËùÒÔΪÁ˸üºÃµÄѧϰ£¬°Ñѧµ½µÄ¶«Î÷¼Ç¼ÏÂÀ´¡£ÎÒѧϰJavaScriptµÄÊéÊÇ¡¶¾«Í¨JavaScript+jQuery¡·£¬Èç¹û´ó¼ÒÓиüºÃµÄÊéÇëÍÆ¼ö¡£
Ò». ʼþµÄ¸ÅÄî
C#ÖÐʼþµÄ¶¨Ò壺ʼþÀàËÆÓÚÒì³££¬Ë ......
×î½üÕâ¶Îʱ¼äÒ»Ö±ÔÚ¸ãǰ¶ËJavaScript£¬ÒÔǰ×ܾõµÃJSûʲô¸ãÍ·£¬¾¹ýÕâÒ»¶ÎµÄÓ¦Ó㬲ŷ¢ÏÖJsÀïÃæµÄ¶«Î÷ÕæµÄºÜÉîºÜÉîµÄ£¬²»È»ÎªÊ²Ã´¸÷´óÃÅ»§ÍøÕ¾¶¼ÕÐÒ»ÅúJS¹¤³ÌÊ¦ÄØ¡£
ÒÔÏÂÎÄÕÂΪÒýÓÃÀîÕ½ÀϸçµÄ¡¶Îò͸JavaScript¡·Ò»ÎÄ£¬Ð´µÄʵÔÚÌ«ºÃÁË£¬¾ÍÊÕ¼ÁË£¬ÒÔ×ö¸ö±¸Óá£
Òý×Ó
& ......
s<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÎÞ±êÌâÎĵµ< ......