gusucode.com > ASP+ACCESS在线人才招聘网(源代码+论文) > ASP+ACCESS在线人才招聘网(源代码+论文)\source_\inc\Keane_Common.js

    <!--
function Jtrim(str)
{

        var i = 0;
        var len = str.length;
        if ( str == "" ) return( str );
        j = len -1;
        flagbegin = true;
        flagend = true;
        while ( flagbegin == true && i< len)
        {
           if ( str.charAt(i) == " " )
                {
                  i=i+1;
                  flagbegin=true;
                }
                else
                {
                        flagbegin=false;
                }
        }

        while  (flagend== true && j>=0)
        {
            if (str.charAt(j)==" ")
                {
                        j=j-1;
                        flagend=true;
                }
                else
                {
                        flagend=false;
                }
        }

        if ( i > j ) return ("")

        trimstr = str.substring(i,j+1);
        return trimstr;
}
//检测Email是否合法
function checkmail(email)
{
if (email=="" )
return false;


	invalidChars = " /:"

	if (email == "") {
		return (false);
	}

	for (i=0; i < invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) != -1) {
			return (false);
		}
	}

	atPos = email.indexOf("@", 1)
	if (atPos == -1) {
		return (false);
	}

	//if (email.indexOf("@", atPos + 1) != -1) {
	//	return (false);
	//}

	periodPos = email.indexOf(".", atPos)
	if (periodPos == -1) {
		return (false);
	}

	if (periodPos + 3 > email.length) {
		return (false);
	}

	return (true);
}
//检测输入日期是否合法-keane
function istrueDate(inputyear,inputmonth,inputday)
{
	var nowdate=new Date();
	var result;
	var varleap_year;
	result=true;
	if ((inputyear<1850)||(inputyear>2500)||(!isDigital(inputyear)))
	{
		result=false;
	}
	if ((((parseInt(inputyear)%4)==0)&&((parseInt(inputyear)%100)!=0))||((parseInt(inputyear)%400)==0))	
	{
		if ((parseInt(inputmonth)==2)&&(parseInt(inputday)>29))
		{
		      result=false;
		}
		switch(parseInt(inputmonth))
		{
			case 4: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
			case 6: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
			case 9: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
			case 11: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
		}
	}
	else
	{
		switch(parseInt(inputmonth))
		{
			case 2: 
			if (parseInt(inputday)>28)
			{
				result=false;break;
			}
			case 4: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
			case 6: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
			case 9: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
			case 11: 
			if (parseInt(inputday)>30)
			{
				result=false;break;
			}
		}
	}
	return result;
}
function isTel(checkStr)
{
var checkOK = "0123456789-/,()";
var allValid = true;
if (checkStr.length<1)
 allValid=false;
  for (i=0;i<checkStr.length;i++)
  {
    ch=checkStr.charAt(i);
    for(j=0;j<checkOK.length;j++)
      if(ch==checkOK.charAt(j))
        break;
    if(j==checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  return allValid;
}


function getStrLength(str)
{
	var L;
	var arr;
	L=0;
	arr=str.split("");
	for (var I=0;I<=arr.length-1;I++)
	{
		if (arr[I].charCodeAt(0)<129)
			L++;
		else
			L=L+2;
	}
	return L
}

function isEmail(s)
{
        if (s.length > 100)
                return false;
         var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[_.0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$";
         var re = new RegExp(regu);
         if (s.search(re) != -1)
              return true;
          else 
             return false;
}


function chooseAll(chooseMode,flag,key){
	for(var i=0;i<=document.thisForm.elements.length-1;i++){
		var e=document.thisForm.elements[i];
		if((e.name).indexOf(key)!=-1) 
		switch(chooseMode){
			case "all":
				e.checked=flag;
			break;
			case "other":
				if(e.checked==true)
					e.checked=false;
				else
					e.checked=true;
			break;
		}
	}
}
//******************************************************//
// 去掉前后空格
//******************************************************//


function isDigital(checkStr)
{
var checkOK = "0123456789";
var allValid = true;
if (checkStr.length<1)
 allValid=false;
  for (i=0;i<checkStr.length;i++)
  {
    ch=checkStr.charAt(i);
    for(j=0;j<checkOK.length;j++)
      if(ch==checkOK.charAt(j))
        break;
    if(j==checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  return allValid;
}



function check_emptydata(obj) {
	var checkobjvalue;
	checkobjvalue=obj.value;
	if (obj.type=="text") {
		if (checkobjvalue.length>1)
			return true;
		else
			return false; 
	}
	if (obj.type=="checkbox" || obj.type=="radio") {
		if (obj.checked==true)
			return true;
		else
			return false; 
	}
}

function addselect(obj,str,seled,fg)
{
	var i=0;
	var arrField=str.split(fg);
	var num=1;
	var j=0;
	obj.clear;
	for(i=0;i<arrField.length;i++)
	{
		var opt=document.createElement("OPTION");
		opt.text=arrField[i];
		opt.value=arrField[i];
		obj.add(opt);
		if (arrField[i]==seled)
		{
		opt.selected=true;
		}
	}
		
}
function GetObjID(ObjName)
{ for (var ObjID=0; ObjID < document.thisForm.elements.length; ObjID++)
    if ( document.thisForm.elements[ObjID].name == ObjName )
    {  return(ObjID);
       break;
    }
  return(-1);
}
function ChangeOption(ObjName, DesName)
{
  //GET OBJECT VALUE, ID OF DESTINATION OBJECT
  ObjID    = GetObjID(ObjName);
  DesObjID = GetObjID(DesName);
  if ( ObjID != -1 && DesObjID != -1 )
  {
    CatValue = document.thisForm.elements[ObjID].value.substring(0, 2);
    if ( CatValue == "0" )
      document.thisForm.elements[DesObjID].length=0;
    else
    { //PARSING
      document.thisForm.elements[DesObjID].length=0;
      var tt = document.thisForm.CompanyPosition.value;
      var SubCategory = tt.split(";");
      //GENERATE OPTIONS
      document.thisForm.elements[DesObjID].options[0]= new Option("---请选择---", "0");
      j=1;
      for (var i=0; i< SubCategory.length; i++ )
      {
        pp = SubCategory[i].split(",");
        if ( pp[0].substring(0,2) == CatValue && pp[0].substring(2,4) != "00" )
        {
          document.thisForm.elements[DesObjID].options[j]= new Option( pp[1], pp[0]);
          j++;
        }
      }
    }
  }
}

function selectedjob_additem()
{
itemname=document.thisForm.jobmaincatalogry.options[document.thisForm.jobmaincatalogry.selectedIndex].text;
itemname=itemname+"-"+document.thisForm.jobsubcatalogry.options [document.thisForm.jobsubcatalogry.selectedIndex].text;

var option=document.createElement("OPTION");
option.text=itemname;
option.value=document.thisForm.jobsubcatalogry .options [document.thisForm.jobsubcatalogry .selectedIndex ].value;
if (document.thisForm.selectedjob.length<=3) 
{
 duplicate=false;
for(i=0;i<=document.thisForm.selectedjob.length-1;i++)
		{
			if(document.thisForm.selectedjob.options[i].value==option.value)
				{
					duplicate=true;
					break;
				}
		}
	if (duplicate==false)
		document.thisForm.selectedjob.add(option);
}
	for (i=1;i<thisForm.selectedjob.length;i++)
		{
			document.thisForm["jobfunction"+i].value=document.thisForm.selectedjob.options[i].value
			document.thisForm["jobfunctionname"+i].value=document.thisForm.selectedjob.options[i].text
		}
}
function selectedjob_removeitem()
{
	if (document.thisForm.selectedjob.selectedIndex>0)
		document.thisForm.selectedjob.remove(thisForm.selectedjob.selectedIndex);
		for (i=1;i<=3;i++)
		{
			document.thisForm["jobfunction"+i].value=""
			document.thisForm["jobfunctionname"+i].value=""
		}	
	for (i=1;i<thisForm.selectedjob.length;i++)
		{
			document.thisForm["jobfunction"+i].value=document.thisForm.selectedjob.options[i].value
			document.thisForm["jobfunctionname"+i].value=document.thisForm.selectedjob.options[i].text
		}	
}



//教育背景页面控制
function checkbox_Degree1()
{
	if (document.thisForm.Degree1.checked==true) {
		    document.thisForm.y_AP_OneFrom.disabled=false;
			document.thisForm.m_AP_OneFrom.disabled=false;
			document.thisForm.y_AP_OneTo.disabled=false;
			document.thisForm.m_AP_OneTo.disabled=false;
			document.thisForm.schoolOne.disabled=false;
			document.thisForm.specialityOne.disabled=false;
			document.thisForm.certificateOne.disabled=false;
			document.thisForm.y_AP_OneFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_OneFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.y_AP_OneTo.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_OneTo.style.backgroundColor="#FFFFFF";
			document.thisForm.schoolOne.style.backgroundColor="#FFFFFF";
			document.thisForm.specialityOne.style.backgroundColor="#FFFFFF";
			document.thisForm.certificateOne.style.backgroundColor="#FFFFFF";
		      
	}
	else {
			document.thisForm.y_AP_OneFrom.disabled=true;
			document.thisForm.m_AP_OneFrom.disabled=true;
			document.thisForm.y_AP_OneTo.disabled=true;
			document.thisForm.m_AP_OneTo.disabled=true;
			document.thisForm.schoolOne.disabled=true;
			document.thisForm.specialityOne.disabled=true;
			document.thisForm.certificateOne.disabled=true;
			document.thisForm.y_AP_OneFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_OneFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.y_AP_OneTo.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_OneTo.style.backgroundColor="#E3E3E3";
			document.thisForm.schoolOne.style.backgroundColor="#E3E3E3";
			document.thisForm.specialityOne.style.backgroundColor="#E3E3E3";
			document.thisForm.certificateOne.style.backgroundColor="#E3E3E3";
	}
}
function checkbox_Degree2()
{
	if (document.thisForm.Degree2.checked==true) {
		    document.thisForm.y_AP_TwoFrom.disabled=false;
			document.thisForm.m_AP_TwoFrom.disabled=false;
			document.thisForm.y_AP_TwoTo.disabled=false;
			document.thisForm.m_AP_TwoTo.disabled=false;
			document.thisForm.schoolTwo.disabled=false;
			document.thisForm.specialityTwo.disabled=false;
			document.thisForm.certificateTwo.disabled=false;
			document.thisForm.y_AP_TwoFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_TwoFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.y_AP_TwoTo.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_TwoTo.style.backgroundColor="#FFFFFF";
			document.thisForm.schoolTwo.style.backgroundColor="#FFFFFF";
			document.thisForm.specialityTwo.style.backgroundColor="#FFFFFF";
			document.thisForm.certificateTwo.style.backgroundColor="#FFFFFF";
		      
	}
	else {
			document.thisForm.y_AP_TwoFrom.disabled=true;
			document.thisForm.m_AP_TwoFrom.disabled=true;
			document.thisForm.y_AP_TwoTo.disabled=true;
			document.thisForm.m_AP_TwoTo.disabled=true;
			document.thisForm.schoolTwo.disabled=true;
			document.thisForm.specialityTwo.disabled=true;
			document.thisForm.certificateTwo.disabled=true;
			document.thisForm.y_AP_TwoFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_TwoFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.y_AP_TwoTo.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_TwoTo.style.backgroundColor="#E3E3E3";
			document.thisForm.schoolTwo.style.backgroundColor="#E3E3E3";
			document.thisForm.specialityTwo.style.backgroundColor="#E3E3E3";
			document.thisForm.certificateTwo.style.backgroundColor="#E3E3E3";
	}
}
function checkbox_Degree3()
{
	if (document.thisForm.Degree3.checked==true) {
		    document.thisForm.y_AP_ThreeFrom.disabled=false;
			document.thisForm.m_AP_ThreeFrom.disabled=false;
			document.thisForm.y_AP_ThreeTo.disabled=false;
			document.thisForm.m_AP_ThreeTo.disabled=false;
			document.thisForm.schoolThree.disabled=false;
			document.thisForm.specialityThree.disabled=false;
			document.thisForm.certificateThree.disabled=false;
			document.thisForm.y_AP_ThreeFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_ThreeFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.y_AP_ThreeTo.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_ThreeTo.style.backgroundColor="#FFFFFF";
			document.thisForm.schoolThree.style.backgroundColor="#FFFFFF";
			document.thisForm.specialityThree.style.backgroundColor="#FFFFFF";
			document.thisForm.certificateThree.style.backgroundColor="#FFFFFF";
		      
	}
	else {
			document.thisForm.y_AP_ThreeFrom.disabled=true;
			document.thisForm.m_AP_ThreeFrom.disabled=true;
			document.thisForm.y_AP_ThreeTo.disabled=true;
			document.thisForm.m_AP_ThreeTo.disabled=true;
			document.thisForm.schoolThree.disabled=true;
			document.thisForm.specialityThree.disabled=true;
			document.thisForm.certificateThree.disabled=true;
			document.thisForm.y_AP_ThreeFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_ThreeFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.y_AP_ThreeTo.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_ThreeTo.style.backgroundColor="#E3E3E3";
			document.thisForm.schoolThree.style.backgroundColor="#E3E3E3";
			document.thisForm.specialityThree.style.backgroundColor="#E3E3E3";
			document.thisForm.certificateThree.style.backgroundColor="#E3E3E3";
	}
}
function checkbox_Degree4()
{
	if (document.thisForm.Degree4.checked==true) {
		    document.thisForm.y_AP_FourFrom.disabled=false;
			document.thisForm.m_AP_FourFrom.disabled=false;
			document.thisForm.y_AP_FourTo.disabled=false;
			document.thisForm.m_AP_FourTo.disabled=false;
			document.thisForm.schoolFour.disabled=false;
			document.thisForm.specialityFour.disabled=false;
			document.thisForm.certificateFour.disabled=false;
			document.thisForm.y_AP_FourFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_FourFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.y_AP_FourTo.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_FourTo.style.backgroundColor="#FFFFFF";
			document.thisForm.schoolFour.style.backgroundColor="#FFFFFF";
			document.thisForm.specialityFour.style.backgroundColor="#FFFFFF";
			document.thisForm.certificateFour.style.backgroundColor="#FFFFFF";
		      
	}
	else {
			document.thisForm.y_AP_FourFrom.disabled=true;
			document.thisForm.m_AP_FourFrom.disabled=true;
			document.thisForm.y_AP_FourTo.disabled=true;
			document.thisForm.m_AP_FourTo.disabled=true;
			document.thisForm.schoolFour.disabled=true;
			document.thisForm.specialityFour.disabled=true;
			document.thisForm.certificateFour.disabled=true;
			document.thisForm.y_AP_FourFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_FourFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.y_AP_FourTo.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_FourTo.style.backgroundColor="#E3E3E3";
			document.thisForm.schoolFour.style.backgroundColor="#E3E3E3";
			document.thisForm.specialityFour.style.backgroundColor="#E3E3E3";
			document.thisForm.certificateFour.style.backgroundColor="#E3E3E3";
	}
}
function checkbox_Degree5()
{
	if (document.thisForm.Degree5.checked==true) {
		    document.thisForm.y_AP_FiveFrom.disabled=false;
			document.thisForm.m_AP_FiveFrom.disabled=false;
			document.thisForm.y_AP_FiveTo.disabled=false;
			document.thisForm.m_AP_FiveTo.disabled=false;
			document.thisForm.schoolFive.disabled=false;
			document.thisForm.specialityFive.disabled=false;
			document.thisForm.y_AP_FiveFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_FiveFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.y_AP_FiveTo.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_FiveTo.style.backgroundColor="#FFFFFF";
			document.thisForm.schoolFive.style.backgroundColor="#FFFFFF";
			document.thisForm.specialityFive.style.backgroundColor="#FFFFFF";
		      
	}
	else {
			document.thisForm.y_AP_FiveFrom.disabled=true;
			document.thisForm.m_AP_FiveFrom.disabled=true;
			document.thisForm.y_AP_FiveTo.disabled=true;
			document.thisForm.m_AP_FiveTo.disabled=true;
			document.thisForm.schoolFive.disabled=true;
			document.thisForm.specialityFive.disabled=true;
			document.thisForm.y_AP_FiveFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_FiveFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.y_AP_FiveTo.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_FiveTo.style.backgroundColor="#E3E3E3";
			document.thisForm.schoolFive.style.backgroundColor="#E3E3E3";
			document.thisForm.specialityFive.style.backgroundColor="#E3E3E3";
	}
}
function checkbox_Degree6()
{
	if (document.thisForm.Degree6.checked==true) {
		    document.thisForm.y_AP_SixFrom.disabled=false;
			document.thisForm.m_AP_SixFrom.disabled=false;
			document.thisForm.y_AP_SixTo.disabled=false;
			document.thisForm.m_AP_SixTo.disabled=false;
			document.thisForm.schoolSix.disabled=false;
			document.thisForm.specialitySix.disabled=false;
			document.thisForm.y_AP_SixFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_SixFrom.style.backgroundColor="#FFFFFF";
			document.thisForm.y_AP_SixTo.style.backgroundColor="#FFFFFF";
			document.thisForm.m_AP_SixTo.style.backgroundColor="#FFFFFF";
			document.thisForm.schoolSix.style.backgroundColor="#FFFFFF";
			document.thisForm.specialitySix.style.backgroundColor="#FFFFFF";
		      
	}
	else {
			document.thisForm.y_AP_SixFrom.disabled=true;
			document.thisForm.m_AP_SixFrom.disabled=true;
			document.thisForm.y_AP_SixTo.disabled=true;
			document.thisForm.m_AP_SixTo.disabled=true;
			document.thisForm.schoolSix.disabled=true;
			document.thisForm.specialitySix.disabled=true;
			document.thisForm.y_AP_SixFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_SixFrom.style.backgroundColor="#E3E3E3";
			document.thisForm.y_AP_SixTo.style.backgroundColor="#E3E3E3";
			document.thisForm.m_AP_SixTo.style.backgroundColor="#E3E3E3";
			document.thisForm.schoolSix.style.backgroundColor="#E3E3E3";
			document.thisForm.specialitySix.style.backgroundColor="#E3E3E3";
	}
}



/**
*测试中英文长度,
*返回值为字符串(包括中文)的长度
*/
function strLen(s)
{
    var i,str1,str2,str3,nLen;
    str1 = s;
    nLen = 0;
    for(i=1;i<=str1.length;i++)
    {
        str2=str1.substring(i-1,i)
        str3=escape(str2);
        if(str3.length>3)
        {
            nLen = nLen + 2;
        }
        else
        {
            nLen = nLen + 1;
        }
    }
    return nLen;
}


function IsValidString(checkStr)
{
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
var allValid = true;
if (checkStr.length<1)
 allValid=false;
  for (i=0;i<checkStr.length;i++)
  {
    ch=checkStr.charAt(i);
    for(j=0;j<checkOK.length;j++)
      if(ch==checkOK.charAt(j))
        break;
    if(j==checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  return allValid;
}


function checkIdCard(s, s1)
    {
        var flag;
        var s2;
        var s5;
        var s8;
        var s11;
       var s_year;
       var s_month;
       var s_day;
       flag=true;
	s_year=s1.substring(0,4);
	s_month=s1.substring(5,7);
	s_day=s1.substring(8,10);
        if(s.length!= 15 && s.length!= 18 || !istrueDate(s_year,s_month,s_day))
            flag = false;
        else
        if(s.length == 15)
        {
            if(!isDigital(s))
            {
                flag = false;
            } else
            {
                var s3 = "19" + s.substring(6, 8);
                var s6 = s.substring(8, 10);
                var s9 = s.substring(10, 12);
                var s12 = s3 + "-" + s6 + "-" + s9;
                if(s12!=s1)
                    flag = false;
            }
        } else
        if(s.substring(17,18)=="X" || s.substring(17,18)=="x")
        {
            if(!isDigital(s.substring(0,17))) {
                flag = false;
            }
        } else
        if(!isDigital(s))
        {
            flag = false;
        } else
        {
            var s4 = s.substring(6,10);
            var s7 = s.substring(10,12);
            var s10 = s.substring(12,14);
            var s13 = s4 + "-" + s7 + "-" + s10;
            if(s13!=s1)
                flag = false;
        }
        return flag;
}
//-->