all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

length property

Gets the number of characters in a TextNode object.

Syntax

JavaScript

p = object.length

Property values

Type: Integer

the number of characters.

Standards information

Examples

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


<script type="text/javascript">
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</li>
</ul>

See also

TextNode
StaticNodeList

 

 

Send comments about this topic to Microsoft

Build date: 11/28/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.