比如:
<button type="button" onclick="document.getElementById('id1').style.color='red'">Click Here</button>
去掉 type="button" , 页面上的button也没啥变化啊
解决方案
<input type="button"/> type浏览器一般是默认为text 而非button
<button>OK</button> type可以是 button、reset、submit 不同浏览器可能默认不同,最好指定,不同于input的button的是 他内部可以放置内容,比如文本或图像。