// JavaScript Document
     var code ; //在全局 定义验证码
     function createCode()
      { 
	          code = "";
              var codeLength = 4;//验证码的长度
			  var getcheckcode=document.getElementById("displaycode")
              //var selectChar = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');//所有候选组成验证码的字符，当然也可以用中文的
              var selectChar = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');//所有候选组成验证码的字符，当然也可以用中文的
              var display='';
              for(var i=0;i<codeLength;i++)
              {
                    var charIndex = Math.floor(Math.random()*26);
					     display+=' '+selectChar[charIndex];
                         code+=selectChar[charIndex];
              }
             
			 document.getElementById('displaycode').innerHTML='<b>'+display+'</b>';
              
         
       }
     
       function validate()
      {
               var attachCode = document.form1.attach.value;
			   if (document.form1.adminid.value.length==0)
			   {
				   alert("[软件提示]：请输入用户名");
				   document.form1.adminid.focus();
				   return false;
			   }
			   if (document.form1.password.value.length==0)
			   {
				   alert("[软件提示]：请输入登录密码"); 
				   document.form1.password.focus();
				   return false;
			   }
			 
               if(attachCode.length <=0)
                {
                     alert("[软件提示]：请输入验证码！");
					 document.form1.attach.focus();
					 return false;
                }
               else if(attachCode.toUpperCase()!=code)
               {
                   alert("[软件提示]：验证码输入错误！");
                   createCode();//刷新验证码
				   document.form1.attach.focus();
				   return false;
				   
               }
               else
               {
                   //alert("^-^ OK");
				   document.form1.action='admin_check_login.asp';
				   document.form1.submit();
               }
       
        }
		
		