<script>
window.onload = function (){
var aBtn = document.getElementsByTagName(‘input‘);
var arr = [ ‘A‘, ‘B‘, ‘C‘, ‘D‘ ];
for( var i=0; i<aBtn.length; i++ ){
aBtn[i].num = 0;
aBtn[i].onclick = function (){
// alert( arr[ this.num ] );
this.value = arr[ this.num ];
this.num++;
if( this.num === arr.length ){
this.num = 0;
}
};
}
};
</script>
</head>
<body>
<input type="button" value="0" />
<input type="button" value="0" />
<input type="button" value="0" />
</body>
原文:https://www.cnblogs.com/tongguilin/p/12192981.html