//****************************************************************************************// //**************************************jquery扩展****************************************// $.fn.extend({ getFormData: function () { /// /// 获取form表单内容,返回json数据 /// var dataArray = $(this).serializeArray(); var jsonData = {}; $.each(dataArray, function () { if (jsonData[this["name"]]) { jsonData[this["name"]] = jsonData[this["name"]] + "," + $.trim(this["value"]); } else { jsonData[this["name"]] = $.trim(this["value"]); } }); return jsonData; } }); $.extend({ dateFormatter: function (date) { return date.format("yyyy-MM-dd"); }, dateFieldFamtter: function (value, row, index) { if (!value) return ""; value = value || ''; return value.toDateString('yyyy-MM-dd hh:mm:ss.S'); }, createGUID: function () {//生成GUID var s4 = function () { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } var guid = s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); return guid; }, createViewPage: function (uniqueID) { var _this = $("#" + uniqueID); _this["get"] = function (jqExp) { return _this.find(jqExp); }; return _this; }, isNullOrEmpty: function (value) { /// /// 验证对象是否为undefined||null||empty /// return true||false||undefined /// if (typeof (value).toLowerCase() != "string") { return undefined; } return (!value || !value.length); }, decode: function (string) { string = string.replace(/\"/g, "\""); string = string.replace(/\@~/g, "\["); string = string.replace(/\@!/g, "\]"); string = string.replace(/\\\\/g, "\\"); string = string.replace(/\</g, "<"); string = string.replace(/\>/g, ">"); return string; }, getUrlParameter: function (asName){ var lsURL=window.location.href; loU = lsURL.split("?"); if (loU.length>1){ var loallPm = loU[1].split("&"); for (var i=0; i1){ return loPm[1]; }else{ return ""; } } } } return null; } }); //******************************************End******************************************// //***************************************************************************************//