var input_elm = document.createElement("input"); //<input>生成 input_elm.setAttribute("type","text"); //<input type="text">として属性追加。 document.getElementById("sample").appendChild(input_elm); //<-id:sampleで指定された要素の子要素として追加