Home > Web Front-end > JS Tutorial > body text

Jquery operation js array and object sample code_jquery

WBOY
Release: 2016-05-16 16:48:51
Original
1408 people have browsed it

Post a piece of code for jQuery's operations on js objects and arrays: addition, deletion, modification and query.

Copy code The code is as follows:

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×
}
}


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!