﻿// JScript 文件

function String.prototype.Trim() {return   this.replace(/(^\s*)|(\s*$)/g,"");}

function document.onkeydown()                //网页内按下回车触发
{
    if(event.keyCode==13)
    {
        if(form1.Top1_txtNum.value!=""||form1.Top1_txtPwd.value!="")
        {
            if(form1.Top1_txtNum.value=="")
            {
                alert("用户名不能为空！");
                form1.Top1_txtNum.focus();
                form1.Top1_txtNum.select();
                return false;
            }
            else if(form1.Top1_txtPwd.value=="")
            {
                alert("密码不能为空！");
                form1.Top1_txtPwd.focus();
                form1.Top1_txtPwd.select();
                return false;
            }
            else
            {
                document.getElementById("Top1_btnLogin").click();   //服务器控件btnLogin点击事件被触发
                return true;
            }
        }
        else if(form1.txtSearch.value!="")
        {
            if(form1.txtSearch.value.Trim()=="")
            {
                alert("搜索内容不能为空！");
                form1.txtSearch.focus();
                form1.txtSearch.select();
                return false;
            }
            else
            {
                document.getElementById("btnSearch").click();   //服务器控件btnLogin点击事件被触发
                return true;
            }
        }
    }
}