默认;
<script>
window.onload=function(){
/*一些代码*/
}
</script>
获取元素
//根据ID
document.getElementById ="myID";
//根据类
document.getELementsByClass="myClass";
//根据tag标签
document.getElementsByTagName="input";
修改样式
document.getElementById(id).style.property=new style
或者
var myEvent = document.getElementById(id)
myEvent.style.background = ‘red‘;
原文:https://www.cnblogs.com/seeding/p/12067952.html