js对json增删改查操作
2011-03-08 14:09
357 查看
<script type="text/javascript">
Array.prototype.clear = function() {
this.length = 0;
}
Array.prototype.insertAt = function(index, obj) {
this.splice(index, 0, obj);
}
Array.prototype.remove = function(index) {
this.splice(index, 1);
}
var t = [{ 'a': {'c':22}, 'b': 2 }, { 'a': 2}];
t.push({ 'a': 3 }); //增
//t[0].a = 11; //改
//t.remove(0); //删
alert(t[0].a.c);
</script>
Array.prototype.clear = function() {
this.length = 0;
}
Array.prototype.insertAt = function(index, obj) {
this.splice(index, 0, obj);
}
Array.prototype.remove = function(index) {
this.splice(index, 1);
}
var t = [{ 'a': {'c':22}, 'b': 2 }, { 'a': 2}];
t.push({ 'a': 3 }); //增
//t[0].a = 11; //改
//t.remove(0); //删
alert(t[0].a.c);
</script>
相关文章推荐
- js--操作json[对一个json数组的增删改查]
- json数据在js中的常见操作
- Json——js对Json的操作
- JS操作JSON总结
- nodejs 增删该查操作数据库(routes文件夹下的users.js)
- JS操作JSON
- json 操作(js和asp.net)
- JS操作JSON总结
- 【JSON】JS操作JSON(不断积累中)
- JS操作JSON总结
- JS操作JSON总结
- JS操作JSON常用方法
- JS操作JSON总结
- JS操作JSON总结
- js 操作json数据
- js操作json总结
- JSON.parse()和JSON.stringify() 和 json.js+ jquery 操作笔记
- nodejs 增删该查操作数据库(routes文件夹下的users.js)
- Json——js和C#对Json的操作
- 接受json文件,并进行增删该查一系列操作