Export (0) Print
Expand All
all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize

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

StaticNodeList
TextNode

 

 

Show:
© 2014 Microsoft