Jquery操作js数组及对象示例代码_jquery_脚本之家

2019-12-30 作者:亚洲城动态   |   浏览(132)

贴一段jQuery对js对象及数组的操作:增删改查的代码。

复制代码 代码如下:var WorkList = new Array();//数组对象 //下面是自己定义的实体 function WorkEx(depart, title, begintime, endtime) { this.SId = 0; this.Id = -; this.DepartmentName = depart; this.Title = title; this.BeginTime = begintime; this.EndTime = endtime; this.Description = ""; this.Enable = 0; return this; } function DeleteWork { WorkList = $.grep(WorkList, function { return val.Id != guid; }); ShowWork(); } function ShowWork() { var html = ""; $.each(WorkList, function { html = html " " val.DepartmentName ":" val.Title ",任职时间:" GetJsDate "到" GetJsDate "×"; }); $.html; } function AddWork() { if(CheckIsNull("workaddress","工作地址不能为空") && CheckIsNull("worklevel", "职责不能为空") && CheckIsNull("WorkBegin", "工作开始日期不能为空") && CheckIsNull("WorkLeave", "工作结束日期不能为空") ) { var isok = true; $.each(WorkList, function { if (val.DepartmentName == $ && val.Title == $ && val.BeginTime == $ && val.EndTime == $ { alert; isok= false; } }); if { var onework = new WorkEx.val.val.val.val WorkList.push; // 四川省乐天区某某制药厂× ShowWork(); } } }

本文由yzc216亚洲城发布于亚洲城动态,转载请注明出处:Jquery操作js数组及对象示例代码_jquery_脚本之家

关键词: 亚洲城官网 yzc216亚洲城