Click to See Complete Forum and Search --> : Updating DOM Node values dynamically (JS)


aldend123
October 28th, 2009, 11:59 AM
Hi all,

Having problems with JavaScript changing the nodeValue of some text. If I set x.nodeValue = "xyz", this will work fine and the page is updated accordingly.

But if I do

var myTxt = x.nodeValue.replace(y,z);
x.nodeValue = myTxt;

This does not update, however if I then follow with a document.write(x.nodeValue), it does print out the correct new data. Any ideas? Seems like the page does not recognize the need to "refresh" (forgive my lack of terminology here, new to this topic). I tried creating a new node, assigning myTxt to it, and replacing it in the node tree, however it just replicated the same problem as above. Maybe I did it wrong?

Tested on FF 3.5.3 and IE6, problem seems to exist on both.

Thank you for the time!