Post a piece of code for jQuery's operations on js objects and arrays: addition, deletion, modification and query.
var WorkList = new Array();//array object
//The following are self-defined entities
function WorkEx(depart, title, begintime, endtime) {
this.SId = 0;
this.Id = -(WorkList.length 1);
this.DepartmentName = depart;
this.Title = title;
this.BeginTime = begintime;
this.EndTime = endtime;
this.Description = "";
this .Enable = 0;
return this;
}
function DeleteWork(guid) {
WorkList = $.grep(WorkList, function (val, key) {
return val.Id! = guid;
});
ShowWork();
}
function ShowWork() {
var html = "";
$.each(WorkList, function (key, val) {
html = html "
" val.DepartmentName ":" val.Title
", service time: " GetJsDate(val.BeginTime) " to " GetJsDate( val.EndTime) "×";
});
$("#tdWorkList").html(html);
}
function AddWork() {
if(CheckIsNull("workaddress","Work address cannot be empty")
&& CheckIsNull ("worklevel", "Responsibility cannot be null")
val()
== $("#WorkLeave").val()
" ); isok= false; worklevel").val(),
.
A certain pharmaceutical factory in Letian District, Sichuan Province× }
}