length property
Gets the number of characters in a TextNode object.
Syntax
| JavaScript | |
|---|
Property values
Type: Integer
the number of characters.
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 1.2
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
Show: