February 2006
Intermediate to advanced
826 pages
63h 42m
English
Well, in that case, we can use the insertBefore( ) method.
var body = document.getElementsByTagName( 'body' )[0]; body.insertBefore( new_div, body.firstChild );
insertBefore( ) takes two arguments: the first is the node you want to insert, and the second is the node you want to insert it in front of. In our example, we are inserting the new div in front of the firstChild of the body element.
Read now
Unlock full access