window.onlineDebug = false; //window.onlineDebug = true;//上线的时候注释掉 if(window.location.search.indexOf("onlineDebug=1")>-1) window.onlineDebug = true; //如果onlineDebug为true的话,表示线上的debug模式打开,那么随时可以报错误了, //onlineDebug 为false的话,那么有错也不会报出来 /* if(!onlineDebug){ if(data == ""){ return; } } 线上执行,线下不执行 */ //封装一下我们的on方法, var tool = { on:function(select,type,cb){ if(typeof type =="function"){ cb = type; type = 'click'; } $('body').on(type,select,cb); } } function get_cookie(Name) { var search = Name + "="//查询检索的值 var returnvalue = "";//返回值 if (document.cookie.length > 0) { sd = document.cookie.indexOf(search); if (sd!= -1) { sd += search.length; end = document.cookie.indexOf(";", sd); if (end == -1) end = document.cookie.length; //unescape() 函数可对通过 escape() 编码的字符串进行解码。 returnvalue=unescape(document.cookie.substring(sd, end)) } } return returnvalue; } //接收参数方法 function GetQueryString(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if(r!=null)return unescape(r[2]); return null; } function addEvent(elem,event,fn) { if(elem.addEventListener){ elem.addEventListener(event,fn,false); }else if (elem.attachEvent){ elem.attachEvent('on'+event,fn); }else{ elem['on'+event]=fn; } }