[Javascript] Comparing Strings - Correction

Triche Osborne wdlists at triche-osborne.com
Thu Aug 25 09:38:37 CDT 2005


Oops! I had this in a testing function and forgot to replace the passed 
variable with its literal.

This line:
> var theNode = document.getElementById(nodeId);

Should read:
var theNode = document.getElementById("replaceThis");

The corrected version would look like this:

<div id="replaceThis">Text to be replaced.</div>

var replacementText = "Hi there!";
var theNode = document.getElementById("replaceThis");
theNode.firstChild.data = replacementText;

Sorry for the confusion!

Triche




More information about the Javascript mailing list