<form id="form1" runat="server">
<p id="demo"></p>
</form>
<script type="text/javascript">
$(function () {
var fruits = ["Bnana ", "Orange ", "Apple ", "Mango "];
fruits.splice(2, 0, "Lemon ", "Kiwi ");
$("#demo").html(fruits);
//splice给数组添加数据
});
</script>
fruits.splice(2, 0, "Lemon ", "Kiwi "); //splice的2是索引,0是添加数据
var fruits = ["Bnana ", "Orange ", "Apple ", "Mango "];
fruits.splice(2, 1, "Lemon ","Fenli ");
$("#demo").html(fruits);
//splice给数组删去原数组,添加新数组
var fruits = ["Bnana ", "Orange ", "Apple ", "Mango "];
fruits.splice(2, 2);
$("#demo").html(fruits);
//去掉元素
if (data.code == 201) {
var data1 = ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'];
var data2 = ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'];
var data3 = ['8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'];
for (var i = 0; i < data.data.length; i++) {
for (var j = 0; j < data3.length; j++) {
if (data.data[i].goodsno == data3[j]) {
data1.splice(j, 1, data.data[i].PeopleNum)
}
}
}
for (var i = 0; i < data.data.length; i++) {
for (var j = 0; j < data3.length; j++) {
if (data.data[i].goodsno == data3[j]) {
data2.splice(j, 1, data.data[i].goodsSpec)
}
}
}
GetKeLiuData(data1, data2)
}
网友评论