123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
-
- //****************************************************************************************//
- //**************************************jquery扩展****************************************//
- $.fn.extend({
- getFormData: function () {
- /// <summary>
- /// 获取form表单内容,返回json数据
- /// </summary>
- 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) {
- /// <summary>
- /// 验证对象是否为undefined||null||empty
- /// return true||false||undefined
- /// </summary>
- 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; i<loallPm.length; i++){
- var loPm = loallPm[i].split("=");
- if (loPm[0].toLowerCase()==asName.toLowerCase()){
- if (loPm.length>1){
- return loPm[1];
- }else{
- return "";
- }
- }
- }
- }
- return null;
- }
- });
- //******************************************End******************************************//
- //***************************************************************************************//
|