功能 | 代码 |
删除数组元素,通过index | Array.prototype.remove=function(dx) { if(isNaN(dx)||dx>this.length){return false;} for(var i=0,n=0;i<this.length;i++) { if(this[i]!=this[dx]) { this[n++]=this[i] } } this.length-=1 } |
创建对象 | function createStoreModel(){ var r ={}; r.entitySetName = ''; r.appSpaceId = ''; r.description = ''; return r; } |
使表单元素无效 | $(".schema_info").each(function(){ this.disabled = true; }) |
插入对象到数组 | 由于是对象传递,因此最常用的方法是先push一个对象到数组,而后直接赋值arrayTest.push({obj.name:?,obj.id=?}); 或先push一个对象,而后再copy arrayTest.push({}) arrayTest[arrayTest.length-1].name=? .......... |