会计考友 发表于 2012-8-4 12:28:23

Java认证之jquery操作单选、复选、下拉(4)

Java认证之jquery操作单选、复选、下拉(4)


else
{
alert(“待删除的项不存在!”);
}
}
//删除select中指定索引的项
jQuery.fn.removeIndex = function(index)
{
var count = this.size();
if(index 》= count || index 《 0)
{
alert(“待删除项索引超出范围”);
}
else
{
jQuery(this).get(0).remove(index);
}
}
//删除select中选定的项
jQuery.fn.removeSelected = function()
{
var index = this.getSelectedIndex();
this.removeIndex(index);
}
//清除select中的所有项
jQuery.fn.clearAll = function()
{
jQuery(this).get(0).options.length = 0;
}
页: [1]
查看完整版本: Java认证之jquery操作单选、复选、下拉(4)