原文链接js创建与追加元素http://www.cnblogs.com/wbengineer/p/4709605.html
<div>
<button onclick="creatEle" id="btn">点击创建新btn
</button>
<div>
<script>
var newBtn = document.creatElement('button');
newBtn.value="value";
newBtn.style.width = 50px;
newBtn.style.height = 50px;
var oldBtn = document.getElementById('btn');
var parentNode = oldBtn.parentNode;
parentNode.insertBefore(newBtn,oldBtn.nextSiblings)
</script>
转载请注明原文地址: https://ju.6miu.com/read-5983.html