DHTML Object Properties DHTML Objects
Returns the length of the data in a TextNode object.
HTML |
N/A |
Script |
[ iLength = ] object.length |
iLength |
Integer specifying the data length in a TextNode. |
The property is read-only with no default value.
The following sample demonstrates the use of the length object property to dynamically set where a TextNode is split using the splitText method.
<script language="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>
<li>Start Here
</ul>
TextNode