/*** @author Hechen*/var gs = {/** Get Width **/screenWidth: function () {return window.screen.width; }, / *** Obtener la altura de la pantalla ** / screenHeight: function () {return window.screen.height; }, / ** Get Browser *** / Browse: function () {var Browser = {}; var userAgent = Navigator.Useragent.tOlowerCase (); var s; (S = UserAgent.Match (/msie ([/d.font>+)/))? browser.ie = s [1]: (s = useragent.match (/firefox // ([/d.]+)/))? navegador.firefox = s [1]: (s = useragent.match (/chrome // ([/d.]+)/))? navegador.chrome = s [1]: (s = useragent.match (/ópera. ([/d.]+)/))? navegador.opera = s [1]: (s = useragent.match (/versión // ([/d.]+).*safari/))? navegador.safari = s [1]: 0; VAR VELEE = ""; if (browser.ie) {versión = 'ie' + browser.ie; } else {if (browser.firefox) {version = 'Firefox' + browser.firefox; } else {if (browser.chrome) {versión = 'chrome' + browser.chrome; } else {if (browser.opera) {versión = 'opera' + browser.opera; } else {if (browser.safari) {version = 'safari' + browser.safari; } else {versión = 'Browser desconocido'; }}}} Versión de retorno; }, / ** Obtenga el sistema operativo *** / clientos: function () {var Suseragent = navigator.useragent; var iswin = (navigator.platform == "win32") || (navigator.platform == "Windows"); var ismac = (navigator.platform == "Mac68k") || (Navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel"); if (isMac) return "Mac"; var isunix = (navigator.platform == "x11") &&! iswin &&! ismac; if (isunix) return "unix"; var islinux = (string (navigator.platform) .indexof ("linux")> -1); if (islinux) return "Linux"; if (iswin) {var iswin2k = Suseragent.indexof ("Windows NT 5.0")> -1 || Suseragent.Indexof ("Windows 2000")> -1; if (iswin2k) return "win2000"; var iswinxp = Suseragent.IndexOf ("Windows NT 5.1")> -1 || Suseragent.IndexOf ("Windows XP")> -1; if (iswinxp) return "winxp"; var iswin2003 = Suseragent.IndexOf ("Windows NT 5.2")> -1 || Suseragent.IndexOf ("Windows NT 5.2")> -1; if (iswin2003) return "win2003"; var iswinvista = Suseragent.Indexof ("Windows NT 6.0")> -1 || Suseragent.Indexof ("Windows Vista")> -1; if (iswinvista) return "winvista"; var iswin7 = Suseragent.indexof ("Windows NT 6.1")> -1 || Suseragent.Indexof ("Windows 7")> -1; if (iswin7) return "win7"; } return "otro"; }, / **** Get Client ID **** / ClientID: function (name) {var cookies = document.cookie.split (";"); value var = ""; for (var i = 0; i <cookies.length; i ++) {var temp = cookies [i] .split ("="); var tempValue = temp [0] .replace (/(^/s*) | (/s*$)/g, ""); if (tempValue == name) {value = unescape (temp [1]); romper; }} Valor de retorno; }, / **** Obtener ID de producto **** / Searchgid: function () {var url = window.location.href; value var = ""; if (url! = Undefined && url! = "") {url.replace (/-/d+-/, function (a, b, c) {if (a! = Undefined && a! = "" && a.length> 2) {value = a.substring (1, a.length-1);}); } valor de retorno; }, / **** Obtenga la palabra clave de búsqueda del sitio **** / SearchKey: function () {var url = window.location.href; value var = ""; if (url! = Undefined && url! = "") {url.replace (/horrible } valor de retorno; }, / ** Obtener la categoría de producto Número de búsqueda ** / SearchCategory: function () {var url = window.location.href; value var = ""; if (url! = Undefined && url! = "") {url.replace (/-/d+/, function (a, b, c) {if (a! = Undefined && a! = "" && a.length> 1) {valor = a.substring (1);}}); } valor de retorno; }, / **** Search fuera del sitio Google Baidu ***** / SearchSite: function (type) {var referrer = document.referrer; if (referrer! = Undefined && referrer! = "") {if ("google" == type) {url.replace (new Regexp ("(?:^/?? | &) q = (^&]*) (?: & | $)"), function (a, b, c) {if (this._ch! = UNDEFINED && a! = ecurefined &&&2 a.substring (a.indexof ("=") + 1, a.length - 1); } else if ("baidu" == type) {url.replace (new Regexp ("(?:^|/? 1, A.Length - 1); } else if ("sogou" == type) {url.replace (new Regexp ("(?:^|/? 1, A.Length - 1); } else if ("bing" == type) {url.replace (new Regexp ("(?:^|/? | &) q = ([^&]*) (?: & | $)"), function (a, b, c) {if (this._ch! = ecurefined && a! = Undefined && A.length> 0) {a = a.substring (a.substring (") a.length - 1); } } devolver ""; }, / ******* Inserte el valor en la matriz *************** / PushValue: function (Key, Value) {if (this._ch! = Undefined) {this._ch [key] = valor; }}, / *** Parámetros personalizados ** / param: function (valor) {if (this._ch! = Undefined) {this._ch ["_ ps"] = valor; }},/*********** Envíe datos al fondo ************/postdata: function () {$ .AJAX ({url: "http: // localhost: 28482/ajax/statacciones.aspx? T =" + math.random (), type: "post", data: this._ch, éxito: function (data) {{{}}}); }, /*** init: functer () {if (this._ch! = Undefined) {this._ch = Undefined; } this._ch = {}; if (this._reg! = Undefined) {this._reg = undefined; } // Inicializar la url de coincidencia de expresión regular this._reg = new Array (); this._reg [0] = "http://www.google.com.hk (.*)"; this._reg [1] = "http://www.baidu.com (.*)"; this._reg [2] = "http://www.sogou.com (.*)"; this._reg [3] = "http://cn.bing.com (.*)"; // Analizar los parámetros de URL var hosturl = window.location.href; if (hosturl! = Undefined && hosturl! = "") {if ((new Regexp (this._reg [4])). Test (Hosturl)) {this._ch ["_ gid"] = this.searchgid (); } else if ((new RegExp (this._reg [7])). Test (Hosturl)) {} else if ((new Regexp (this._reg [5])). Test (Hosturl))) {this._ch ["_ CID"] = this.SearchCategory (); } else if ((new Regexp (this._reg [5])). Test (Hosturl)) {this._ch ["_ Cid"] = this.searchCategory (); } else if ((new Regexp (this._reg [5])). Test (Hosturl)) {this._ch ["_ Cid"] = this.searchCategory (); } else if ((nuevo) regexp (this._reg [6])). test (hosturl)) {this._ch ["_ key"] = this.searchKey (); } this._ch ["_ tu"] = hosturl; } var referRer = document.referrer; if (referrer! = Undefined && referrer! = "") {if ((new Regexp (this._reg [0])). Test (referrer)) {this._ch ["_ key"] = this.searchSite ("google"); } else if ((new Regexp (this._reg [1])). test (referrer)) {this._ch ["_ key"] = this.searchSite ("baidu"); } else if ((new Regexp (this._reg [2])). Test (referRer)) {this._ch ["_ Key"] = this.searchSite ("Sogou"); } else if ((new Regexp (this._reg [3])). test (referRer)) {this._ch ["_ key"] = this.searchSite ("bing"); } this._ch ["_ su"] = referente; } // Obtener información relacionada con el cliente this._ch ["_ SW"] = this.screenWidth (); this._ch ["_ sh"] = this.screenheight (); this._ch ["_ bw"] = this.browse (); this._ch ["_ cs"] = this.clientos (); this._ch ["_ Mid"] = this.clientid ("from_channelid"); this._ch ["_ ctid"] = this.clientid ("clientKey"); }, _ch: indefinido, _reg: indefinidoLo anterior es todo el contenido de este artículo. Para obtener más información sobre JavaScript, puede consultar: "Tutorial de referencia de JavaScript" y "Guía de estilo de código JavaScript". También espero que todos apoyen más a Wulin.com.