js array 数组删除元素

/* 
     *  方法:Array.remove(dx) 
     *  功能:根据元素位置值删除数组元素. 
     *  参数:元素值 
      *  返回:在原数组上修改数组 
      */
        Array.prototype.baoremove = function(dx) {
            if (isNaN(dx) || dx > this.length) {
                return false;
            }
            this.splice(dx, 1);
        };

然后在数组上直接调用即可

for (var k = 0; k < ClassStudentList.CheckedList.length; k++) 
{
        if (ClassStudentList.CheckedList[k].Cid==cid) 
           {
                     ClassStudentList.CheckedList.baoremove(k);
               }  
    }
posted @ 2013-07-08 18:02  梨花驿路  阅读(516)  评论(0编辑  收藏  举报