Click to Rate and Give Feedback
Properties
 length Property
length Property

Gets the number of characters in a TextNode object.

Syntax

[ iLength = ] TextNode.length

Possible Values

iLengthInteger that receives the number of characters.

The property is read-only. The property has no default value.

Example

This example uses the length property to specify where a TextNode is split by using the splitText method.

<SCRIPT>
function fnChangeValue(){
   var oListItem = document.createElement("LI");
   oList.appendChild(oListItem);
   var oNode = oList.firstChild.childNodes(0);
   var oTextNode = oList.firstChild.childNodes(0);
   var oSplit = oTextNode.splitText(oTextNode.length/2);
   oListItem.appendChild(oSplit);

}
</SCRIPT>

<UL ID = oList onclick = "fnChangeValue()">
<LI>Start Here
</UL>

Standards Information

This property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link.

Applies To

TextNode
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker