<p>点击按钮创建文本域。</p> <button onclick="myFunction()">点我</button> <script> function myFunction() { var x = document.createElement("INPUT"); x.setAttribute("type", "text"); x.setAttribute("value", "Hello World!"); document.body.appendChild(x); } </script>