案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<input value="OK">
6
7
<p id="demo">点击按钮来设置按钮的 type 属性。</p>
8
9
<button onclick="myFunction()">试一下</button>
10
11
<script>
12
function myFunction()
13
{
14
document.getElementsByTagName("INPUT")[0].setAttribute("type","button"); 
15
}
16
</script>
17
18
<p>Internet Explorer 8 以及更早的版本不支持此方法。</p>
19
20
</body>
21
</html>
22