/*
Determine if it is the home page
*/
function Ishomepage () {
var localurl = window.location.href;
var regex = new RegExp ("^https?:/ /(test-)? www\.4008000000.com (/?| /index[(. | _)].*|/? [?]. *) $ "," I ");
Return Regex.test (Localurl);
}
/**
* Determine if the page is 404
*/
function Isfindpage () {
var localurl = window.location.href;
var regex = new RegExp ("^https?:/ /(test-)? www\.4008000000.com (/?| /404[(. | _)].*|/? [?]. *) $ "," I ");
Return Regex.test (Localurl);
}
function Common_search_baoxian (str) {
var keyword= $ (' #keyword '). Val ();
var searchvalue = $.trim (keyword);
if (""! = str) {
Searchvalue = str;
$ (' #keyword '). val (str);
}
If it is not the first page, search box empty check
if (!ishomepage () && (Searchvalue = = "" | | Searchvalue = = Defalutsearchkeyword[0].defalutkeyword)) {
$ (' #keyword '). Val (Defalutsearchkeyword[0].defalutkeyword);
$ (' #keyword '). CSS ("Color", "#666666");
Return
}
var reg =/^\s+|\s+$/g;
var searchvalueobj = getdefalutsearchkeywordobj (Searchvalue);
If it is the first page, then the special keyword check jump
if (((Ishomepage () | | isfindpage ()) && (Searchvalue.replace (Reg, ") = =" "| | Searchvalue = = Searchvalueobj.defalutkeyword | | Searchvalue = = Searchvalueobj.keyword)) | | (!ishomepage () && searchvalue = = Searchvalueobj.keyword)) {
$ (' #keyword '). Val (Searchvalueobj.keyword);
$ (' #keyword '). CSS ("Color", "#ABA9A9");
window.open (Searchvalueobj.keywordurl + "? keyword=" + encodeURIComponent (Searchvalueobj.keyword), "_blank");
}
else{
var emallcontext = "http://www.4008000000.com/zixun/baoxian/search/search_list.shtml";
var httpurl = Emallcontext + '? keyword= ' + encodeURIComponent (searchvalue);
//window.open (httpurl, "_blank");
Window.location.href=httpurl;
}
}
JS judge whether it is the first page, 404 pages