Function insertafter (newelement,targetelement) { //inserts a new element behind an existing element, which is a general-purpose function var parent = Targetelement.parentnode;if (parent.lastchild == targetelement) {parent.appendchild (newElement);} Else{parent.insertbefore (newelement,targetelement.nextsibling);}} Function preparegallery () { //traversal array if (! document.getElementsByTagName) return false;if (!document.getelementbyid) return false;if (! document.getelementsbytagname| |! document.getElementById) { return false;} var gallery = document.getelementbyid ("Imagegallery"); var links = gallery.getelementsbytagname ("a"); for ( var i=0; i < links. length; i++) { links[i].onclick = function () { return !showpic (this); } links[i].onkeypress = links[i].onclick; }}
Inserts a new element after an existing element, which belongs to the general function InsertAfter (newelement,targetelement)