var sfadmin = { def_data_tag : 'tbody', def_select_input : '.select_item', init: function() { $('.select_rows').click(function () { var tableid = $(this).data(sfadmin.def_data_tag); $('#'+tableid).find(sfadmin.def_select_input).attr('checked', this.checked); }); sfadmin.ajax.error(); }, getSelected : function(tableid){ if(tableid == "") { dom = $(sfadmin.def_select_input + ':checked'); }else{ dom = $(sfadmin.def_select_input + ':checked', '#'+tableid); } datas = new Array(); dom.each(function(index, element) { datas.push($(this).val()); }); return datas; }, ajax : { error : function(){ $(document).ajaxError(function(event, request, settings) { sfadmin.Alert("请求中发生错误"); }) } }, setCookie : function (name,value){ var Days = 30; var exp = new Date(); //new Date("December 31, 9998"); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); }, getCookie : function (name){ var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) return unescape(arr[2]); return null; }, delCookie : function(name){ var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval=getCookie(name); if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString(); }, Alert : function(content){ $.colorbox({width:'50%',html:'

'+content+'

'}); } }