HTML DOM Input Button 对象
Input Button 对象
Input Button 对象代表已设置 type="button" 的 HTML <input> 元素。
访问 Input Button 对象
您可以使用 getElementById() 访问 type="button" 的 <input> 元素:
var x = document.getElementById("myBtn");
提示:您还可以通过搜索表单的 elements 集合 来访问 <input type="button">。
创建 Input Button 对象
您可以使用 document.createElement() 方法创建 type="button" 的 <input> 元素:
var x = document.createElement("INPUT"); x.setAttribute("type", "button");