
一般是用 [][] 来读
例如 :
String[][] strs = new String[3][3];
strs[0] = new String[]{"1","2","3"};
strs[1] = new String[]{"1","2","3"};
strs[2] = new String[]{"1","2","3"};
Systemoutprintln(strs[0][0]);
Systemoutprintln(strs[1][1]);
Systemoutprintln(strs[2][2]);
加上条件的话 用双重循环体来实现
String[][] strs = new String[3][3];
strs[0] = new String[]{"1","2","3"};
strs[1] = new String[]{"1","2","3"};
strs[2] = new String[]{"1","2","3"};
for(int a = 0;a<strslength;a++){
for(int c = 0; c<strs[a]length;c++){
Systemoutprint(strs[a][c]);
}
Systemoutprintln();
}
直接用js里的getElementsByName就可以获取所以name值相同的元素。但获取出来的并不是数组,而是类数组的元素集合。所以还需要一步变换,下面是简单代码:
<body><input type="text" name="111" />
<input type="text" name="111" />
<input type="text" name="111" />
<input type="text" name="111" />
<input type="text" name="111" />
<input type="text" name="111" />
<input type="text" name="111" />
<input type="text" name="111" />
</body>
<script>
var oInp = documentgetElementsByName('111');
var aInp = [];
for(var i=0;i<oInplength;i++){
aInppush(oInp[i]);
}
</script> //这样aInp这个数组里存储的就是所以元素name为111的数组。
以上就是关于使用jqGrid怎么获取数组中的子数组全部的内容,包括:使用jqGrid怎么获取数组中的子数组、怎么用javascript/jquery在当前页面获取动态添加的表单的name和值并且变成整个数组、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)