代码:
<script type="text/javascript"> var i = 0; function add(){ var inputNode = document.createElement("input"); inputNode.setAttribute("type", "button"); inputNode.setAttribute("value", "按钮"+i); i++; var bodyNode = document.getElementsByTagName("body"); bodyNode[0].appendChild(inputNode); } </script>
原文:http://www.cnblogs.com/tianhengblogs/p/6523074.html