Using innerHTML method instead of addChild in javascript
by Ramya[ Edit ] 2008-06-18 18:30:51
> In javascript getElementById() method is used to get the HTML form element with the specified Id.
for example,
var xxx = document.getElementById("idform");
will get the HTML form element with the id "idform" and stored in the variable xxx.
> Content can be added dynamically to the element using addChild method as,
xxx.addChild(someValue);
> Instead of using addChild, innerHTML is also used to add value to the element at run time as,
xxx.innerHTML = 'somevalue';
or you can use,
document.getElementById('idForm').innerHTML = 'someValue';
> When the innerHTML property is set, the given string completely replaces the existing content of the object.