JQuery

1个成员

jquery仿51job搜索查询代码

发表于 2017-01-22 3603 次查看
jquery仿51job搜索查询代码

jquery仿51job搜索查询代码

var tmp_area_str = "";
function chkQuickSearch(formname, hasincludearea, isarea) {
  var frm = eval("document." + formname);
  var obj = frm.keyword;
  var isenglish;
  var cdefaultkeyword = '请输入关键字';
  var edefaultkeyword = 'Keyword';
  var objValue = $.trim(obj.value);
  if (window.location.href.indexOf("/default-gj-e.php") > 0) {
    isenglish = 1;
  } else {
    isenglish = 0;
  }
  if (hasincludearea == 1) {
    if (tmp_area_str == "") {
      tmp_area_str = frm.jobarea.value;
    }
    frm.includearea.value = 0;
    if (frm.includearea.checked) {
      frm.includearea.value = 1;
      if (tmp_area_str == "0400") {
        frm.jobarea.value = "0308,0400";
        if (window.location.href.indexOf("/default-area-e.php") > 0) {
          frm.action = "http://search.111cn.cn/esc/search_result.php";
        } else {
          frm.action = "http://search.111cn.cn/jobsearch/search_result.php";
        }
      } else {
        frm.jobarea.value = tmp_area_str.substr(0, 2) + "00";
      }
    } else {
      frm.includearea.value = 0;
      if (tmp_area_str == "0400") {
        if (window.location.href.indexOf("/default-area-e.php") > 0) {
          frm.action = "http://search.111cn.cn/esc/default_search.php";
        } else {
          frm.action = "http://search.111cn.cn/jobsearch/default_search.php";
        }
      }
      frm.jobarea.value = tmp_area_str;
    }
  }
  if (isarea == 1) {
    if ((frm.funtype.value == "") && (objValue == "" || objValue == cdefaultkeyword || objValue == edefaultkeyword)) {
      if (isenglish == 0) {
        window.alert("请输入关键字,或者选择职能类别。");
      } else {
        window.alert("Please enter keyword or select job function.");
      }
      //frm.keyword.value = "";
      //frm.keyword.focus();
      return false;
    }
    if (frm.issuedate.value == "") {
      frm.issuedate.value = 8;
    }
    if (objValue == cdefaultkeyword || objValue == edefaultkeyword) {
      obj.value = "";
    }
    return true;
  } else {
    if (frm.jobarea.value == "") {
      if (isenglish == 0) {
        window.alert("地点必须选择且不能为不限!");
      } else {
        window.alert("Please select Location!");
      }
      return false;
    }
    if (frm.funtype.value == "" && (objValue == "" || objValue == cdefaultkeyword || objValue == edefaultkeyword)) {
      if (isenglish == 0) {
        window.alert("请输入关键字,或者选择职能类别。");
      } else {
        window.alert("Please enter keyword or select job function.");
      }
      return false;
    }
    if (frm.issuedate.value == "") {
      frm.issuedate.value = 8;
    }
    if (frm.jobarea.value == "0000" && frm.funtype.value == "" && (objValue == "" || objValue == cdefaultkeyword || objValue == edefaultkeyword)) {
      if (isenglish == 0) {
        window.alert("请输入关键字!");
      } else {
        window.alert("Please input keyword!");
      }
      obj.value = "";
      obj.style.color = "";
      obj.focus();
      return false;
    } else {
      if (objValue == cdefaultkeyword || objValue == edefaultkeyword) {
        obj.value = "";
      }
      return true;
    }
  }
}

function chkKeywordSearch(formId, tipValue) {
  var obj = $("#"+formId)[0].keyword;
  var cdefaultkeyword = '请输入关键字';
  var edefaultkeyword = 'Keyword';
  var objValue = $.trim(obj.value);
  if (objValue == "" || objValue == cdefaultkeyword || objValue == edefaultkeyword ) {
    alert(tipValue);
    obj.value = "";
    obj.focus();
    obj.style.color = "";
    return false;
  }
  return true;
}


function focusKeyword(obj,defaultKeyword){
  if(obj.value == defaultKeyword){
    obj.value = "";
    obj.focus();
  }
  obj.style.color = "";
}

function hotSearch(obj) {
  var keyword = $.trim($(obj).html());
  var formObj = $("#frmKeywordSearch")[0];
  formObj.keyword.value = keyword;
  formObj.fromType.value = 3;
  formObj.submit();
}

function switchSearchType(divId) {
  if(divId == "searchform1"){
    $("#searchform2").hide();
    $("#searchform1").show();
    var formObj = $("#frmKeywordSearch")[0];
    formObj.keyword.focus();
    FocusEnd(formObj.keyword);
  } else if(divId == "searchform2"){
    $("#searchform1").hide();
    $("#searchform2").show();
    var formObj = $("#frmQuickSearch")[0];
    formObj.keyword.focus();
    FocusEnd(formObj.keyword);
  }
}

 

发表回复
你还没有登录,请先登录注册