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