﻿// JScript 文件


var no=null;
function checkName()
{
var str =document.getElementById("use_id").value;
    if(str!="")
    {
    
        aa("use_id","checkHtml","checkAsp.aspx?name="+str+"");
    }
    else
    {
        erro_div("checkHtml","系统未检测到您的输入");
    }
}
function aa(id,showId,url)
{
var name=document.getElementById(id).value;
makeRequest(url+name,showId);
}

//--------------------------------------------------
//验证开始
function erro_div(id,txt)
{
            document.getElementById(id).innerHTML="<p>"+ txt +"</p>";
            document.getElementById(id).style.border="1px solid #CC0000";
            document.getElementById(id).style.color="#CC0000";
            
            document.getElementById(id).style.background="url(images/erro.gif) left no-repeat";
}
function yes_div(id,txt)
{
            
            document.getElementById(id).innerHTML="<p>"+ txt +"</p>";
            document.getElementById(id).style.border="1px solid #66CC00";
            document.getElementById(id).style.color="#66CC00";
            
            document.getElementById(id).style.background="url(images/yes.gif) left no-repeat";
}

function checkPwd(id)
{
    if(id.value!="")
    {
        if(id.value.length<7)
        {
            erro_div("Pwd","输入错误 | 密码长度不能小于7位");
        }
        else
        {
            yes_div("Pwd","内容符合规范,可以使用");
        }
    }
    else
    {
        erro_div("Pwd","系统未检测到您的输入");
    }
}
function checkPwd_check(id)
{
    if(id.value!="")
    {
    
        if(id.value!=document.getElementById("use_pwd").value)
        {
    
            erro_div("checkPwd","输入错误 | 两次输入的密码不一致");
        }
        else if(id.value.length<7)
        {
       
            erro_div("checkPwd","输入错误 | 密码长度不能小于7位");
        }
        else
        {
         
            yes_div("checkPwd","内容符合规范,可以使用");
        }
    }
    else
    {
       
        erro_div("checkPwd","系统未检测到您的输入");
    }
}
//checkUseName
function checkUse_name(id)
{
    if(id.value=="")
    {
        erro_div("checkUseName","输入错误 | 系统未检测到您的输入");
    }
    else
    {
        yes_div("checkUseName","内容符合规范,可以使用");
    }
}

function checkphone(id)
{
    if(id.value=="")
    {
        erro_div("checkUseName","输入错误 | 系统未检测到您的输入");
    }
    else
    {
        yes_div("checkUseName","内容符合规范,可以使用");
    }
}

function checkfile(id)
{
    var kkk=false;
    var temp=form1.file_img.value;
    var aaa=temp.split('.');
    var str=aaa[aaa.length-1].toUpperCase();
    if(str!="")
    {
        if(str=="GIF"||str=="JPG")
        {
            yes_div("divFile","内容符合规范");
        }
        else
        {
            erro_div("divFile","您上传的文件格式不正确");
        }
    }
    else
    {
        erro_div("divFile","系统未检测到您的输入");
    }
}


function kkk(id)
{  
    id.value=id.value.replace(/[^\d]/g,'');
}

function btnfile()
{
    var kkk=false;
    var temp=form1.file_img.value;
    var aaa=temp.split('.');
    var str=aaa[aaa.length-1].toUpperCase();
    if(str=="GIF"||str=="JPG")
    {
        return true;
    }
    else if(form1.file_img.value=="")
    {
        return true;
    }
    else
    {
        return false;
    }
}