var cookie = { set: function(key, val, time) { var date = new Date(); var expiresDays = time; date.setTime(date.getTime() + expiresDays * 1000); document.cookie = key + "=" + val + ";expires=" + date.toGMTString() + "; path=/" }, get: function(key) { var getCookie = document.cookie.replace(/[ ]/g, ""); var arrCookie = getCookie.split(";"); var tips; for (var i = 0; i < arrCookie.length; i++) { var arr = arrCookie[i].split("="); if (key == arr[0]) { tips = arr[1]; break } } return tips }, delete: function(key) { var date = new Date(); date.setTime(date.getTime() - 10000); document.cookie = key + "=v; expires =" + date.toGMTString() }, deleteAll: function() { var date = new Date(); date.setTime(date.getTime() - 100000000); var keys = document.cookie.match(/[^ =;]+(?=\=)/g); if (keys) { for (var i = keys.length; i--;) document.cookie = keys[i] + "=0; expire=" + date.toGMTString() + "; path=/" } }, }; //PC�� �ƶ��� ��ת var calurl = "/"; //var calurl = "http://localhost:22130/"; cookie.set('ref', window.location.href); var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null; if (is_mobi) { var href = cookie.get('ref'); if (href) { console.log(href); href = href.replace(calurl, calurl + "lhzy_m/"); if(href==calurl+"lhzy_m/"){ href=calurl+"lhzy_m/index.html" } console.log(href); window.location.href = href; } else { window.location.href = "/lhzy_m/index.html"; } } else { // window.location.href="http://www.zxtop.cn/index.html" }