﻿// JScript 文件

//去除空格
        String.prototype.trim= function()
        {  
            return this.replace(/(^\s*)|(\s*$)/g, "");  
        }
        function checkaccount()
        {
            if(document.getElementById('txtAccount').value.trim() == "")
            {
                alert('用户名不能为空！');
            document.getElementById('txtAccount').focus();
            return false;
            }
            for(i= 0;i< document.getElementById('txtAccount').value.length;i++)
            {
            s   =   document.getElementById('txtAccount').value.charCodeAt(i);   
            if(!(((s>=48) && (s<=   57)) || ((s>=65) && (s<=90)) || ((s>=97) && (s<=122)) || (s>160) || (s==45) || (s==95)))
            {   
                alert("用户名应为中文、字母或数字！");
                return false;   
            }
        }
        return true;
        }
        
        function checkpwd()
        {
        if(document.getElementById('txtPwd').value.trim() == "")
        {
            alert('密码不能为空！');
            document.getElementById('txtPwd').focus();
            return false;
        }
        return true;
        }
        function check()
        {
            if(checkaccount())
            {
                if(checkpwd())
                {
                    return true;
                }
            }
            return false;
        }
        
        
        function showPer(){
var divper = document.getElementById('divper'); 
divper.style.display="block"; 
 
divper.style.left=event.clientX+10;  
divper.style.top=event.clientY+5; 
divper.style.position="absolute"; 
} 
function closePer(){ 
var divper = document.getElementById('divper'); 
divper.style.display="none"; 
} 
     

function showCom(){
var divcom = document.getElementById('divcom');  
divcom.style.display="block"; 
 
divcom.style.left=event.clientX+10; 
divcom.style.top=event.clientY+5; 
divcom.style.position="absolute"; 
} 
function closeCom(){ 
var divcom = document.getElementById('divcom'); 
divcom.style.display="none"; 
} 