x
 
<!DOCTYPE html>
<html>
<body>
<input type="button" value="OK">
<p id="demo">点击按钮来删除 input 元素的 type 属性。</p>
<button onclick="myFunction()">试一下</button>
<script>
function myFunction()
{
var btn=document.getElementsByTagName("INPUT")[0];
btn.attributes.removeNamedItem("type");
}
</script>
<p><b>注释:</b>当删除 input 元素的 type 属性后,此元素的类型将是 <em>text</em>,即默认值。</p>
<p><b>注释:</b>在 Internet Explorer 8 以及更早的版本中,removedNamedItem 不会返回属性。</p>
</body>
</html>