/** * 商品搜索 */ function goods_search(){ var keys = $("#keywords").val(); if(keys == ''){ alert("请填写搜索关键字") return false; } var url = BASE_URL + "goods/search/keys/"+keys window.open(url) } /** * 设置cookie * @param {[type]} name [description] * @param {[type]} value [description] * @param {[type]} time [description] */ function setCookies(name, value, time) { var cookieString = name + "=" + escape(value) + ";"; if (time != 0) { var Times = new Date(); Times.setTime(Times.getTime() + time); cookieString += "expires="+Times.toGMTString()+";" } document.cookie = cookieString+"path=/"; } // 读取 cookie function getCookie(c_name) { if (document.cookie.length>0) { c_start = document.cookie.indexOf(c_name + "=") if (c_start!=-1) { c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return ""; } function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }