您现在的位置是:首页 > 电脑技术查询 > web开发

js数组有关问题

编辑:chaxungu时间:2022-10-02 23:15:26分类:web开发

js数组问题
三个按钮value 分别为(1,2,3); 分别点击按钮往数组里添加value

------解决方案--------------------
HTML code<script>var array = [];</script><input type='button' value='1' onclick='array.push(this.value)' /><input type='button' value='2' onclick='array.push(this.value)' /><input type='button' value='3' onclick='array.push(this.value)' /><input type='button' value='show' onclick='alert(array)'/>
------解决方案--------------------
探讨

HTML code
<script>
var array = [];

</script>
<input type='button' value='1' onclick='array.push(this.value)' />
<input type='button' value='2' onclick='array.push(this.value)' />
<input type='butto……