如果数组元素是Element元素的对象,for...in...
先记下。。。
这个不行:
<script type="text/javascript">
var payInput = $('rechPrice');
var fastSelect = $('fastSelect').getElementsByTagName('input');
for(var i in fastSelect){
fastSelect[i].onclick = function(){payInput.value = this.value;}
}
</script>
这个就可以:
<script type="text/javascript">
var payInput = $('rechPrice');
var fastSelect = $('fastSelect').getElementsByTagName('input');
for(var i = 0 ;i < fastSelect.length;i++){
fastSelect[i].onclick = function(){payInput.value = this.value;}
}
</script>