D
Daz
Hi everyone.
I am trying to figure out if it's possible to dynamically change the
value of a textNode.
I seem to remember experiementing before I implemented them into my
page, and I was able to do so. However, I can't seem to get it to work
now, and I am considering going back to using <span> elements, and
innerHTML to change the value.
Here's some code:
//********** CODE START **********
Many thanks.
Daz.
I am trying to figure out if it's possible to dynamically change the
value of a textNode.
I seem to remember experiementing before I implemented them into my
page, and I was able to do so. However, I can't seem to get it to work
now, and I am considering going back to using <span> elements, and
innerHTML to change the value.
Here's some code:
//********** CODE START **********
//***********CODE END ***********function example(someText)
{
this.obj;
var titleText = document.createtextNode(someText);
var td = document.createElement('td');
var tr = document.createElement('tr');
var tbody = document.createElement('tbody');
var table = document.createElement('table');
td.appendChild(titleText);
tr.appendChild(td);
tbody.appendChild(tr);
table.appendChild(tbody);
this.obj = table;
this.changeText = function (newText)
{
titleText = newText;
}
}
var newObject = new example('Some Text').
var someElement = document.getElementById('idOfSomeElement');
someElement.appendChild(newObject.obj);
newObject.changeText = 'New Text';
the only way forward, or am I missing something here (as usual).From what I can see, the textNode value remains the same. is innerHTML
Many thanks.
Daz.