标签:onclick rip var click doc sub function getattr 索引
<script>
var ary=[];
var ary1=[];
var json=[];
document.getElementById(‘sub_add‘).onclick=function(){
var shipNum=document.getElementsByClassName(‘shipNum‘);
for(var i=0;i<shipNum.length;i++){
ary.push(shipNum[i].getAttribute(‘data-id‘));
ary1.push(shipNum[i].getAttribute(‘data-num‘));
}
var json1={};
for(var a=0;a<ary.length;a++){
json1[a]=[ary[a],ary1[a]];
}
document.getElementById(‘hidden‘).value=json1;
}
</script>
标签:onclick rip var click doc sub function getattr 索引
原文地址:http://www.cnblogs.com/ytg1120/p/7101329.html