

//函数名：fucCheckNUM
//功能介绍：检查是否为数字
//参数说明：要检查的数字
//返回值：1为是数字，0为不是数字
function fucCheckNUM(NUM)
{
	var i,j,strTemp;
	strTemp="0123456789";
	if ( NUM.length== 0)
		return 0
	for (i=0;i<NUM.length;i++)
	{
		j=strTemp.indexOf(NUM.charAt(i));	
		if (j==-1)
		{
		//说明有字符不是数字
			return 0;
		}
	}
	//说明是数字
	return 1;
}

//函数名：chkspc
//功能介绍：检查是否含有空格
//参数说明：要检查的字符串
//返回值：0：是  1：不是
function chkspc(a)
{
	var i=a.length;
	var j = 0;
	var k = 0;
	while (k<i)
	{
		if (a.charAt(k) != " ")
			j = j+1;
		k = k+1;
	}
	if (j==0)
	{
		return 0;
	}
	
	if (i!=j)
	{ return 2; }
	else
	{
		return 1;
	}
}
function isNumberString (InString,RefString){
	if(InString.length==0) return (false);
	for (Count=0; Count < InString.length; Count++){
		TempChar= InString.substring (Count, Count+1);
		if (RefString.indexOf (TempChar, 0)==-1)  
		return (false);
	}
	return (true);
	}
function checkinput()
{
    if (chkspc(document.myform.firstdesire.value)==0)
	{	alert("请选择专业!");
		document.myform.firstdesire.focus();
		return false;
	}
   
    if (chkspc(document.myform.username.value)==0)
	{	alert("请您填写真实姓名!");
		document.myform.username.focus();
		return false;
	}
	if (document.myform.username.value.length>20)
	{	alert("请正确填写您的姓名，不能超过20位！");
		document.myform.username.focus();
		return false;
	}
   

    
if(isNumberString(document.myform.usercode.value,"1234567890X")!=1){
   alert("身份证号只能是数字和“X”！");
	 document.myform.usercode.focus();
	  return false;
 }
	if (document.myform.usercode.value.length!=18)
	{	alert("请正确填写身份证号,身份证号为18位！");
		document.myform.usercode.focus();
		return false;
	}
    if (chkspc(document.myform.results.value)!=0)
	{
        if (document.myform.results.value.length>20)
	      {	  alert("此项可不填写，如要填写高考成绩，不能超过20位！");
		      document.myform.results.focus();
		      return false;
	       }	
	}
   
    if (chkspc(document.myform.levels.value)==0)
	{	alert("请您填写目前学历!");
		document.myform.levels.focus();
		return false;
	}
	if (document.myform.levels.value.length>20)
	{	alert("请正确填写您的学历，不能超过20位！");
		document.myform.levels.focus();
		return false;
	}
    if (chkspc(document.myform.fromschool.value)!=0)
	{
        if (document.myform.fromschool.value.length>30)
	      {	  alert("此项可不填写，如要填写毕业院校，不能超过30位！");
		      document.myform.fromschool.focus();
		      return false;
	       }	
	}
   
    if (chkspc(document.myform.addr.value)==0)
	{	alert("请您填写通信地址!");
		document.myform.addr.focus();
		return false;
	}
    if (fucCheckNUM(document.myform.postcode.value)==0)
	{	alert("请您正确填写邮编，必需是数字!");
		document.myform.postcode.focus();
		return false;
	}
	if (document.myform.postcode.value.length!=6)
	{	alert("请正确填写邮编,邮编应为6位！");
		document.myform.postcode.focus();
		return false;
	}
    if (chkspc(document.myform.mobile.value)!=0)
	{
        if (document.myform.mobile.value.length!=11)
	      {	  alert("此项可不填写，如要填写，手机号码应为11位！");
		      document.myform.mobile.focus();
		      return false;
	       }
    　　if (fucCheckNUM(document.myform.mobile.value)==0)
	　　　　{	alert("此项可不填写，如要填写，手机号码必需是数字!");
		　　　　document.myform.mobile.focus();
		　　　　return false;
	         }
	}
    if (chkspc(document.myform.phone.value)==0)
	{	alert("请您填写联系电话!");
		document.myform.phone.focus();
		return false;
	}
if(isNumberString(document.myform.phone.value,"1234567890-")!=1){
   alert("电话号码只能包括数字和“-”！");
	 document.myform.phone.focus();
	  return false;
 }
    if (chkspc(document.myform.email.value)!=0)
	{
        if (document.myform.email.value.length>30)
	      {	  alert("此项可不填写，如要填写，不能超过30位！");
		      document.myform.email.focus();
		      return false;
	       }
    　　if (chkemail(document.myform.email.value)==0)
	　　　　{	alert("此项可不填写，如要填写，请正确填写邮箱格式!");
		　　　　document.myform.email.focus();
		　　　　return false;
	         }
	}
  return true;
}


