js 练习

Posted 每天进步一点点!

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js 练习相关的知识,希望对你有一定的参考价值。

 

  1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="req_form.aspx.cs" Inherits="req_form" %>
  2 <%@ Assembly Name="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
  3 <%@ Assembly Name="CodeArt.SharePoint.CamlQuery, Version=1.0.0.0, Culture=neutral, PublicKeyToken=43536cfde91ea799" %>
  4 <%@ Assembly Name="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" %>
  5 <asp:content id="ContentHead" contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
  6     <link href="../css/commom_shenergy_form.css" rel="stylesheet" />
  7     <link href="../css/jquery-ui.css" rel="stylesheet" />
  8     <link href="../themes/default/easyui.css" rel="stylesheet" />
  9      <link href="../css/alert.css" rel="stylesheet" />
 10      <link href="../css/Huploadify.css" rel="stylesheet" />
 11     <script src="../js/jquery-1.11.3.min.js"></script>
 12     <script src="../js/jquery-ui-1.10.4.custom.min.js"></script>
 13     <script src="../js/jquery.easyui.min.js"></script>
 14     <script src="../js/jquery-ui-timepicker-addon.js"></script>
 15     <script src="../js/jquery.ui.datepicker-zh-CN.js"></script>
 16     <script src="../js/jquery-ui-timepicker-zh-CN.js"></script>
 17     <script src="../js/jquery-ui-timepicker-addon.js"></script>
 18     <script src="../js/jquery.Huploadify.js"></script>
 19     <script src="../js/jquery.form.js"></script>
 20     <script src="../js/jquery.alert.js"></script>
 21    <script src="../js/commom_shenergy.js"></script>
 22    <link href="../css/king-table.css" rel="stylesheet" />
 23     <style> 
 24     .right .tableDiv span 
 25     {
 26     display: inline-block;
 27     width: 85px;
 28     font-family: ‘Microsoft YaHei‘;
 29     }
 30 
 31     </style>
 32    <script type="text/javascript">
 33        $(function ()
 34        {
 35            $(.left>ul>li).click(function (event){$(this).toggleClass("leftblock").next(ul).slideToggle(300).siblings("ul").slideUp(300); });
 36            $(.check>.currentdefault).click(function (event) { $(this).toggleClass(tianjia).siblings(); });
 37            $(.HYGM button).click(function (event) { $(this).toggleClass(current).siblings().removeClass(current);});
 38            $(.cspan1 button).click(function (event) { $(this).toggleClass(current).siblings().removeClass(current); });
 39            $(.textBottom button).click(function (event) { $(this).toggleClass(current).siblings().removeClass(current);});
 40            $(".currentdefault").click(function (event) { $(this).toggleClass("current").siblings().removeClass("current")});
 41            $(".check>.currentdefault").click(function (event) { $(this).toggleClass("current").siblings(); });
 42            $("#hide").click(function () {
 43                $(".c_div_showhidenotify").hide();
 44            });
 45 
 46            $("#show").click(function () {
 47                $(".c_div_showhidenotify").show();
 48            });
 49            $("input[name=‘act_start_time‘],input[name=‘act_stop_time‘]").datetimepicker();//datetimepicker
 50            meetroomQuery();
 51            function meetroomQuery() {
 52 
 53                var urlajax = "../Handler/HandlerComMeetRoomsList.ashx?MeetRoomsFlag=All"
 54                $.ajax(
 55                    {
 56                        url: urlajax,//submit to HandlerMeetRoomApplyForm.ashx page
 57                        type: "post",
 58                        async: false,
 59                        dataType: "json",
 60                        data: { method: "Add" },
 61                        success: function (arr) {
 62                            var en = {};
 63 
 64                            for (var i = 0; i < arr.length; i++) {
 65                                $(.cselect2).append("<option value=‘" + arr[i].MeetRoomsId + "‘>" + arr[i].MeetRoomsName + "</option>");
 66                            }
 67                            //$(".cselect2").prepend("<option value=‘0‘ selected=‘selected‘>--请选择--</option>");
 68 
 69 
 70                        },
 71                        error: function (XMLHttpRequest, textStatus, errorThrown) { console.log("新增失败=>" + textStatus); alert(新增失败!); }
 72                    });
 73            }
 74        });
 75    </script>
 76   </asp:content>
 77 <asp:content id="Content1" contentplaceholderid="PlaceHolderMain" runat="Server">
 78     <div class="wrap">
 79     <div class="contentDiv">
 80             <div class="inCon">
 81                 <div class="right">
 82                     <div class="InRight"></div>
 83                     <div class="tableDiv" style="height:200%">
 84                             <span class="spanhead  c_margintop">会议室名称:</span>
 85                             <select class="cselect2"></select><br>    
 86                             <span class="spanhead c_margintop">会议时间:</span>
 87                             <input name="act_start_time" type="text"id="meetingStartTime" class="text-box" 
 88                             value="2016/12/28 16:08" placeholder="开始时间≥当前时间" title="开始时间≥当前时间" readonly="readonly" style="cursor:pointer;"/>
 89                             <input name="act_stop_time" type="text" id="meetingStopTime" class="text-box" 
 90                              value="2016/12/30 16:08" placeholder="结束时间>开始时间" title="结束时间>开始时间" readonly="readonly" style="cursor:pointer;"/><br>    
 91                             <span class="spanhead c_margintop">会议要求:</span>
 92                             <textarea id="textid1" placeholder="会议安排要求">会议要求</textarea>
 93                              <br>
 94                               <span class="spanhead c_margintop">会议备注:</span>
 95                             <textarea id="textid2" placeholder="会议备注">会议备注</textarea> <br>
 96                             <span class="spanhead c_margintop">会议人员:</span><br />
 97                         <div style="width:1200px;height:300px;margin-left: 80px;">
 98                              <div style="margin:10px 0">
 99                       <a href="#" class="easyui-linkbutton" onclick="insert()">添加内部人员</a>       
100                       <a href="#" class="easyui-linkbutton" onclick="insert2()"style="margin-left: 320px;">添加外部人员</a>
101                               </div> 
102                               <div class="aa" style="width: 450px; float: left;">
103                              <table id="tt" ></table>  
104                               </div>   
105                               <div class="aa" style="width: 550px;float: left">
106                               <table id="tt2" ></table> 
107                                </div>
108                         </div>
109                        <div class="c_div_IssendNotify" id="id_div_IssendNotify">
110                             <span class="c_span_IssendNotifyTitle">会议通知:</span>
111                             <span class="currentdefault current" id="show"></span>
112                             <span class="currentdefault" id="hide"></span>
113                             <div class="c_div_showhidenotify" style="margin-left: 80px;">
114                               <textarea class="c_txtr_title" placeholder="通知标题">通知标题</textarea><br />
115                               <textarea class="c_txtr_content" placeholder="通知内容">通知内容</textarea><br />
116                                </div>
117                             </div>
118                         <div>
119                             
120                         </div>
121                        
122                             <div id="id_div_upload"class="c_div_upload" >上传材料:</div>
123                     
124                         <%--<div class="mybtn" id="btnUpdate">更新会议室</div>--%>
125                           <div class="c_div_save_submit_return" style="text-align:center;line-height:18px"> 
126                           <div class="c_div_save diyi"" id="id_div_save" >保存会议申请</div> 
127                          <div class="c_div_submit dier" id="id_div_submit">提交会议申请</div>
128                          <div class="c_div_return disan" id="id_div_return"onclick="javascript:history.go(-1);">返回</div>
129                     </div>
130                     </div>                    
131                 </div>
132             </div>
133         </div>
134       </div>
135     <script>
136        
137         var url = window.location.href;
138         var entity = {};
139             function GetQueryString(name)
140             {
141                 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
142                 var r = window.location.search.substr(1).match(reg);
143                 if (r != null) return unescape(r[2]); return null;
144             }
145             var urlpara = GetQueryString("MeetAppId");
146             console.log("==>modify para====");
147             if (urlpara != null && urlpara.toString().length >= 1)  //
148             {
149                 console.log("==>entry form_Update_pages!");
150                 $(function () {
151                     Query();
152                     $(".InRight").text("会议申请更新");
153                     $(".c_div_submit").text("提交会议申请更新");
154                     $(".c_div_submit").bind("click", submitUpdate);
155                     function GetQueryString(name) {
156                         var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
157                         var r = window.location.search.substr(1).match(reg);
158                         if (r != null) return unescape(r[2]); return null;
159                     }
160                     console.log("entry form_query!");
161                     function Query() {
162                         var urlajax = "../Handler/HandlerMeetingApplicantList.ashx?MeetAppFlag=Detail&MeetAppId=" + urlpara;
163                         modifyPara();
164                         $.ajax({
165                             url: urlajax,//Query
166                             success: function (arr)
167                             {
168                                 alert(arr)
169                                 for (var i = 0; i < arr.length; i++)
170                                 {  
171                                   $(".cselect1").val(en.MeetRoomsName);
172                                    $(".cselect2").val(en.MeetRoomsCheckEmployer);
173                                    var span1 = $("#span1").find("span");
174                                    for (var j = 0; j < span1.length; j++)
175                                     {
176                                         if ($(span1[j]).text() == en.MeetRoomsState)
177                                         {
178                                             $(span1[j]).toggleClass(current).siblings().removeClass(current);
179                                         }
180                                     }
181                                 }
182                             },
183                             error: function (XMLHttpRequest, textStatus, errorThrown) {
184                                 alert(查询错误!);
185                             }
186                         });
187                     }
188                     console.log("==>entry form_Update submit");
189                     function submitUpdate() {
190                         console.log("test submitUpdate start!");
191                         modifyPara();
192                         entity.MeetRoomsId = urlpara;
193                         var urlajax = "../Handler/HandlerMeetingApplicant.ashx?MeetAppFlag=Update&"
194                         $.ajax({
195                             url: urlajax,//submit to HandlerMeetRoomApplyForm.ashx page
196                             type: "post",
197                             async: false,
198                             dataType: "text",
199                             data: { method: "Update",req: JSON.stringify(entity) },
200                             success: function (arr)
201                             {
202                                 if (arr)
203                                 {
204                                     console.log("更新返回值:" + arr);
205                                     window.location.href = ./req_list.aspx;
206                                 }
207                             },
208                             error: function (XMLHttpRequest, textStatus, errorThrown)
209                             {
210                                 alert(错误!);
211                             }
212                         });
213                     }
214                 });
215             }
216             else
217             {
218                 console.log("=>entry form_Add_pages!");
219                 $(function ()
220                 {
221                     $("input[name=‘act_start_time‘],input[name=‘act_stop_time‘]").datetimepicker();//datetimepicker
222                     $(".InRight").text("新增会议申请");
223                     $(".c_div_submit").text("提交会议申请申请");
224                     $(".c_div_submit").bind("click", submitDo);
225                     function submitDo()
226                     {
227                         var entity = {};
228                         var MeetRoomsId = $(".cselect2").val();//会议室名称
229                         if (MeetRoomsId == 0 || MeetRoomsId==null)
230                         {
231                             alert("请选择会议室"); return false;
232                         }
233                         var MeetAppStartT = $("#meetingStartTime").val();
234                         if (MeetAppStartT =="" || MeetAppStartT == null) {
235                             alert("请选择开始时间"); return false;
236                         }
237                         var MeetAppEndT = $("#meetingStopTime").val();
238                         if (MeetAppEndT == "" || MeetAppEndT == null) {
239                             alert("请选择结束时间"); return false;
240                         }
241                         var MeetAppFixedClaims = $("#textid1").val();
242                         if (MeetAppFixedClaims == "" || MeetAppFixedClaims == null) {
243                             alert("请填写会议要求"); return false;
244                         }
245                         var MeetAppRemark = $("#textid2").val();
246                         if (MeetAppRemark == "" || MeetAppRemark == null) {
247                             alert("请填写会议内容"); return false;
248                         }
249                         var MeetAppSendMeetNotice = $(".c_div_IssendNotify > .current").html();
250                         var MeetNoticeTitle = $(".c_txtr_title").val();
251                         var MeetNoticeContent = $(".c_txtr_content").val();
252                         if (MeetAppSendMeetNotice == "")
253                         {
254                             if (MeetNoticeTitle == "" || MeetNoticeTitle == null) {
255                                 alert("请填写会议通知标题"); return false;
256                             }
257                             if (MeetNoticeContent == "" || MeetNoticeContent == null) {
258                                 alert("请填写会议通知内容"); return false;
259                             }
260                         }
261                         entity.MeetRoomsId = MeetRoomsId;
262                         entity.MeetRoomsId = MeetRoomsId,
263                         entity.MeetAppStartT = MeetAppStartT,
264                         entity.MeetAppEndT = MeetAppEndT,
265                         entity.MeetAppFixedClaims = MeetAppFixedClaims,
266                         entity.MeetAppRemark = MeetAppRemark,
267                         entity.MeetNoticeTitle = MeetNoticeTitle,
268                         entity.MeetNoticeContent = MeetNoticeContent,
269                         entity.MeetAppSendMeetNotice = MeetAppSendMeetNotice;
270 
271                         /*-------------内部人员----------------------------*/
272                         var rowsData = $(#tt).datagrid(getRows);
273                         var insideusers = [];
274                         if (rowsData == "" || rowsData == null) { alert("请选择会议内部人员"); return false; }
275                         $.each(rowsData, function (i) {
276                             var loc = {
277                                 "MeetInsiderTitle": rowsData[i].MeetInsiderTitle,
278                                 "MeetInsiderPeo": rowsData[i].MeetInsiderPeo
279                             };
280                             insideusers.push(loc);
281                         });
282                         entity.ListInsider = insideusers;
283 
284                         /*-------------外部人员----------------------------*/
285                        var rowsDatatt2 = $(#tt2).datagrid(getRows);
286                         var outsideusers = [];
287                         $.each(rowsDatatt2, function (i) {
288                             var loc = {
289                                 "MeetOutsidersTitle": rowsDatatt2[i].MeetOutsidersTitle,
290                                 "MeetUnitName": rowsDatatt2[i].MeetUnitName,
291                                 "MeetOutsidersTel": rowsDatatt2[i].MeetOutsidersTel,
292                                 "MeetOutsidersMail": rowsDatatt2[i].MeetOutsidersMail
293                             };
294                             outsideusers.push(loc);
295                         });
296                         entity.ListOutsiders = outsideusers;
297                      
298                         /*-------------会议通知----------------------------*/
299                         entity.MeetNotice = {};
300                         entity.MeetNotice.MeetNoticeTitle = MeetNoticeTitle;
301                         entity.MeetNotice.MeetNoticeContent = MeetNoticeContent;
302                         /*-------------会议材料----------------------------*/
303                         var MeetMaterialId = "";
304                         entity.MeetMaterialId = MeetMaterialId;
305                         var urlajax = "../Handler/HandlerMeetingApplicant.ashx?MeetAppFlag=Add"
306                         $.ajax(
307                             {
308                             url: urlajax,//submit to HandlerMeetRoomApplyForm.ashx page
309                             type: "post",
310                             async: false,
311                             dataType: "json",
312                             data: { method: "Add", req: JSON.stringify(entity) },
313                             success: function (arr)
314                             {
315                                 alert("新增成功11=>" + urlajax + JSON.stringify(entity).toLocaleString() +
316                                     "==>" + "返回标识符:" + arr.ResultMsg + "返回结果:" + arr.ResultMsg);
317                                // window.location.href = ‘./req_list.aspx‘;
318                                
319                             },
320                             error: function (XMLHttpRequest, textStatus, errorThrown) {
321                                 console.log("新增失败=>" + textStatus); alert(新增失败!);
322                             }
323                            });
324                     }
325                 });
326             }
327 
328         </script>
329     <script>
330            $(function()
331            {
332                $(#id_div_upload).Huploadify({
333                       dataType: "json",
334                        auto: true,
335                        fileTypeExts: *.*;,
336                        multi: true,
337                        formData: { key: 123456, key2: vvvv },
338                        fileSizeLimit: 9999,
339                        showUploadedPercent: true,//是否实时显示上传的百分比,如20%
340                        showUploadedSize: true,
341                        removeTimeout: 9999999,
342                        uploader: ../Handler/HandlerMeetingMaterial.ashx?MeetMaterialFlag=Add,
343                        onUploadStart: function () {
344                            console.log(开始上传);
345                        },
346                        onInit: function () {
347                            console.log(初始化);
348                        },
349                        onUploadComplete: function (result) {
350                            
351                            var str = JSON.stringify(result);
352                            console.log(str);
353                           // var str = eval(‘[{ResultMsg: "OK", ResultFlag: "5"}]‘);
354                            //$.each(str, function () {
355                            //    alert(this.ResultMsg + this.ResultFlag);
356                            //});
357                           
358                        },
359                        onUploadSuccess: function (result)
360                        {
361                            var str = JSON.stringify(result);
362                            alert("上传成功!"+str);
363                        },
364                        onDelete: function (file) {
365                            console.log(删除的文件: + file);
366                            console.log(file);
367                        }
368                    });
369                
370            });
371            $(function() 
372              {
373                 $(#tt).datagrid(
374                  {
375                      title: 内部人员,
376                      //iconCls: ‘icon-edit‘,
377                      width:420,
378                      height: 250,
379                      singleSelect: true,
380                      idField: itemid,
381                     // url: ‘../Handler/HandlerMeetingInsider.ashx?MeetInsiderFlag=Add‘,
382                      columns: [[
383                          //{ field: ‘No‘, title: ‘序号‘, width: 60 },
384                          { field: MeetInsiderTitle, title: 姓名, width:100, editor: text, align: center},
385                          { field: MeetInsiderPeo, title: 会议人员, width: 120, align: center, editor: text },
386                          {
387                              field: action, title: 操作, width: 80, align: center,
388                              formatter: function (value, row, index) {
389                                  if (row.editing) {
390                                      var s = <a href="#" onclick="saverow(this)">保存</a> ;
391                                      var c = <a href="#" onclick="cancelrow(this)">取消</a>;
392                                      return s + c;
393                                  } else {
394                                      var e = <a href="#" onclick="editrow(this)">编辑</a> ;
395                                      var d = <a href="#" onclick="deleterow(this)">删除</a>;
396                                      return e + d;
397                                  }
398                              }
399                          }
400                      ]],
401                      onBeforeEdit: function (index, row) {
402                          row.editing = true;
403                          updateActions(index);
404                      },
405                      onAfterEdit: function (index, row) {
406                          row.editing = false;
407                          updateActions(index);
408                      },
409                      onCancelEdit: function (index, row) {
410                          row.editing = false;
411                          updateActions(index);
412                      }
413                  });
414 
415            });
416            $(function () {
417                $(#tt2).datagrid(
418                 {
419                     title: 外部人员,
420                     //iconCls: ‘icon-edit‘,
421                     width: 500,
422                     height: 250,
423                     singleSelect: true,
424                     idField: itemid,
425                    // url: ‘../Handler/HandlerMeetingOutsiders.ashx?MeetOutsidersFlag=Add‘,
426                     columns: [[
427                         //{ field: ‘No‘, title: ‘序号‘, width: 50 },
428                         { field: MeetOutsidersTitle, title: 姓名, width: 100, editor: text, align: center },
429                         { field: MeetUnitName, title: 单位名称, width: 100, editor: text, align: center },
430                         { field: MeetOutsidersTel, title: 手机号, width: 100, editor: text, align: center },
431                         { field: MeetOutsidersMail, title: 邮箱, width: 80, editor: text, align: center },
432 
433                         {
434                             field: action, title: 操作, width: 80, align: center,
435                             formatter: function (value, row, index) {
436                                 if (row.editing) {
437                                     var s = <a href="#" onclick="saverow2(this)">保存</a> ;
438                                     var c = <a href="#" onclick="cancelrow2(this)">取消</a>;
439                                     return s + c;
440                                 } else {
441                                     var e = <a href="#" onclick="editrow2(this)">编辑</a> ;
442                                     var d = <a href="#" onclick="deleterow2(this)">删除</a>;
443                                     return e + d;
444                                 }
445                             }
446                         }
447                     ]],
448                     onBeforeEdit: function (index, row) {
449                         row.editing = true;
450                         updateActions2(index);
451                     },
452                     onAfterEdit: function (index, row) {
453                         row.editing = false;
454                         updateActions2(index);
455                     },
456                     onCancelEdit: function (index, row) {
457                         row.editing = false;
458                         updateActions2(index);
459                     }
460                 });
461 
462            });
463             function updateActions(index) {
464                 $(#tt).datagrid(updateRow, {
465                     index: index,
466                     row: {}
467                 });
468             }
469             function getRowIndex(target) {
470                 var tr = $(target).closest(tr.datagrid-row);
471                 return parseInt(tr.attr(datagrid-row-index));
472             }
473             function editrow(target) {
474                 $(#tt).datagrid(beginEdit, getRowIndex(target));
475             }
476             function deleterow(target) {
477                 $.messager.confirm(确定, 你确定吗?, function (r) {
478                     if (r) {
479                         $(#tt).datagrid(deleteRow, getRowIndex(target));
480                     }
481                 });
482             }
483             function saverow(target) {
484                 $(#tt).datagrid(endEdit, getRowIndex(target));
485         
486             }
487             function cancelrow(target) {
488                 $(#tt).datagrid(cancelEdit, getRowIndex(target));
489             }
490             function insert()
491             {
492                 var row = $(#tt).datagrid(getSelected);
493                 if (row) {
494                     var index = $(#tt).datagrid(getRowIndex, row);
495                 } else {
496                     index = 0;
497                 }
498                 $(#tt).datagrid(insertRow, {
499                     index: index,
500                     row: {
501                         status: P
502                     }
503                 });
504                 $(#tt).datagrid(selectRow, index);
505                 $(#tt).datagrid(beginEdit, index);
506             }
507             function updateActions2(index) {
508                 $(#tt2).datagrid(updateRow, {
509                     index: index,
510                     row: {}
511                 });
512             }
513             function getRowIndex2(target) {
514                 var tr = $(target).closest(tr.datagrid-row);
515                 return parseInt(tr.attr(datagrid-row-index));
516             }
517             function editrow2(target) {
518                 $(#tt2).datagrid(beginEdit, getRowIndex2(target));
519             }
520             function deleterow2(target) {
521                 $.messager.confirm(确定, 你确定吗?, function (r) {
522                     if (r) {
523                         $(#tt2).datagrid(deleteRow, getRowIndex2(target));
524                     }
525                 });
526             }
527             function saverow2(target) {
528                 $(#tt2).datagrid(endEdit, getRowIndex2(target));
529                
530             }
531             function cancelrow2(target) {
532                 $(#tt2).datagrid(cancelEdit, getRowIndex2(target));
533             }
534             function insert2() {
535                 var row = $(#tt2).datagrid(getSelected);
536                 if (row) {
537                     var index = $(#tt2).datagrid(getRowIndex, row);
538                 } else {
539                     index = 0;
540                 }
541                 $(#tt2).datagrid(insertRow, {
542                     index: index,
543                     row: {
544                         status: P
545                     }
546                 });
547                 $(#tt2).datagrid(selectRow, index);
548                 $(#tt2).datagrid(beginEdit, index);
549             }
550           function addMeetingInsider() {
551                
552                 var rowsData = $(#tt).datagrid(getRows);
553                 var json = [];
554                 var loc;
555                 $.each(rowsData, function (i) {
556                     loc = {
557                         
558                         "MeetInsiderTitle": rowsData[i].MeetInsiderTitle,
559                         "MeetInsiderPeo": rowsData[i].MeetInsiderPeo
560                        
561                     };
562                     json.push(loc);
563                 });
564                 json = JSON.stringify(json); //转换成json数据  
565                 alert(json);
566                 var urlajax = "../Handler/HandlerMeetingInsider.ashx?MeetInsiderFlag=Add";
567                 $.ajax(
568                           {
569                               url: urlajax,
570                               type: "post",
571                               async: false,
572                               dataType: "json",
573                               data: { method: "Add", req: JSON.stringify(json) },
574                               success: function (arr) {
575                                   console.log("新增成功=>"
576                                       + urlajax + JSON.stringify(entity).toLocaleString() +
577                                       "==>" + "返回标识符:" + arr.ResultMsg + "返回结果:" + arr.ResultMsg);
578                                   if (arr.ResultFlag == "0") {
579                                       alert("新增成功");
580                                   }
581                                   else { alert("未知错误"); }
582                               },
583                               error: function (XMLHttpRequest, textStatus, errorThrown)
584                               { console.log("新增失败=>" + textStatus); alert(新增失败!); }
585                           });
586             }
587           function  addMeetingOutsiders()
588             {
589                 var rowsData = $(#tt2).datagrid(getRows);
590                 var json = [];
591                 var loc;
592                 $.each(rowsData, function (i) {
593                     loc = {
594 
595                         "MeetOutsidersTitle": rowsData[i].MeetOutsidersTitle,
596                         "MeetUnitName": rowsData[i].MeetUnitName,
597                         "MeetOutsidersTel": rowsData[i].MeetOutsidersTel,
598                         "MeetOutsidersMail": rowsData[i].MeetOutsidersMail
599                     };
600                     json.push(loc);
601                 });
602                 json = JSON.stringify(json); //转换成json数据  
603                 alert(json);
604                 var urlajax = "../Handler/HandlerMeetingOutsiders.ashx?MeetOutsidersId=Add";
605                 $.ajax(
606                           {
607                               url: urlajax,//submit to HandlerMeetRoomApplyForm.ashx page
608                               type: "post",
609                               async: false,
610                               dataType: "json",
611                               data: { method: "Add", req: JSON.stringify(entity) },
612                               success: function (arr) {
613                                   console.log("新增成功=>" + urlajax +
614                                       JSON.stringify(entity).toLocaleString() + "==>" +
615                                       "返回标识符:" + arr.ResultMsg + "返回结果:" + arr.ResultMsg);
616                                   if (arr.ResultFlag == "0") {
617                                       alert("新增成功");
618                                       //window.location.href = ‘./req_list.aspx‘;
619                                   }
620                                   else { alert("未知错误"); }
621                               },
622                               error: function (XMLHttpRequest, textStatus, errorThrown)
623                               { console.log("新增失败=>" + textStatus); alert(新增失败!); }
624                           });
625             }
626     </script>
627     </asp:content>

 

以上是关于js 练习的主要内容,如果未能解决你的问题,请参考以下文章

VSCode自定义代码片段——JS中的面向对象编程

VSCode自定义代码片段9——JS中的面向对象编程

Python练习册 第 0013 题: 用 Python 写一个爬图片的程序,爬 这个链接里的日本妹子图片 :-),(http://tieba.baidu.com/p/2166231880)(代码片段

js代码片段: utils/lcoalStorage/cookie

JS代码片段:一个日期离现在多久了

js常用代码片段(更新中)