asp.net.ph

Skip Navigation Links

nodeValue Property

DHTML Object Properties   DHTML Objects


DOM Level 1 Specification.

Sets or retrieves the value of a node.

Syntax

HTML N/A
Script [ sValue = ] object.nodeValue

Possible Values

sValue String value.

The property is read-write with no default value. The value depends on the value of the nodeType property.

Example

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.

  • Old Node Value

See Also

nodeName, nodeType


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note