Using innerHTML method instead of addChild in javascript

by Ramya 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.

Tagged in:

8644
like
0
dislike
0
mail
flag

You must LOGIN to add comments