Click to See Complete Forum and Search --> : js code, getElementsByTagName("head")[0].appendChild(js);


kennyTE
07-01-2007, 06:50 PM
can someone explain what below code means?

document.getElementsByTagName("head")[0].appendChild(js);

Banana Ananda
07-01-2007, 06:58 PM
Put the element, previously assigned to the variable, js, inside the first (zero-th) <head> element in the document. The element will end up being the last element inside it's parent (-appendChild)

<head>
...
...
<someNewElement>
</head>