//既存の要素の後に新しい要素を追加します
function insertAfter(newElement, targetElement){
varparent = targetElement.parentNode;
if (parent.lastChild == targetElement){
parent.appendChild(newElement)
} else {
parent .insertBefore(newElement,targetElement.nextSibling);
}
}