x
 
<!DOCTYPE html>
<html>
<body>
<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>
</body>
</html>