DHTML Object Properties DHTML Objects
DOM Level 1 Specification.
Sets or retrieves the value of a node.
HTML |
N/A |
Script |
[ sValue = ] object.nodeValue |
The property is read-write with no default value. The value depends on the value of the nodeType property.
The following sample demonstrates the use of the nodeValue object property to dynamically set the value of a text node.
<script language="JavaScript">
function chgVal ( ) {
var oNode = oList.firstChild.childNodes ( 0 );
if ( oNode.nodeValue == "Old Node Value" )
oNode.nodeValue = "New Node Value";
else oNode.nodeValue = "Old Node Value";
}
</script>
<ul id = oList onclick = "chgVal ( )">
<li>
<li>Old Node Value
</ul>
Click on the bulleted list item to see.
nodeName, nodeType