function SetLogin()
{
if(document.all.Name.value=='')
{
alert('用户名不能为空!');
document.all.Name.focus();
return false;
}
if(document.all.Pass.value=='')
{
alert('密码不能为空!');
document.all.Pass.focus();
return false;
}
return true;
}

解决方案 »

  1.   

    <input type="radio" name="sex" value="女">
    女</div></td>
          </tr>
          <tr bordercolor="#FFFFFF">
            <td> <div align="right">生日:</div></td>
            <td bordercolor="#FFFFFF">
              <div align="justify">
              <select name="year">
                <option selected>1949</option>
                <option>1950</option>
                <option>1951</option>
                <option>1952</option>
                <option>1953</option>
                <option>1954</option>
                <option>1955</option>
                <option>1956</option>
                <option>1957</option>
                <option>1958</option>
                <option>1959</option>
                <option>1960</option>
                <option>1961</option>
                <option>1962</option>
                <option>1963</option>
                <option>1964</option>
                <option>1965</option>
                <option>1966</option>
                <option>1967</option>
                <option>1968</option>
                <option>1969</option>
                <option>1970</option>
                <option>1971</option>
                <option>1972</option>
                <option>1973</option>
                <option>1974</option>
                <option>1975</option>
                <option>1976</option>
                <option>1977</option>
                <option>1978</option>
                <option>1979</option>
                <option>1980</option>
                <option>1981</option>
                <option>1982</option>
                <option>1983</option>
                <option>1984</option>
                <option>1985</option>
                <option>1986</option>
                <option>1987</option>
                <option>1988</option>
                <option>1989</option>
                <option>1990</option>
                <option>1991</option>
                <option>1992</option>
                <option>1993</option>
                <option>1994</option>
                <option>1995</option>
                <option>1996</option>
                <option>1997</option>
                <option>1998</option>
                <option>1999</option>
                <option>2000</option>
              </select>

    <select name="month">
      <option selected>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8</option>
          <option>9</option>
          <option>10</option>
          <option>11</option>
          <option>12</option>
    </select>

    <select name="day">
          <option selected>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8</option>
          <option>9</option>
          <option>10</option>
          <option>11</option>
          <option>12</option>
          <option>13</option>
          <option>14</option>
          <option>15</option>
          <option>16</option>
          <option>17</option>
          <option>18</option>
          <option>19</option>
          <option>20</option>
          <option>21</option>
          <option>22</option>
          <option>23</option>
          <option>24</option>
          <option>25</option>
          <option>26</option>
          <option>27</option>
          <option>28</option>
          <option>29</option>
          <option>30</option>
          <option>31</option>
    </select>
    日</div></td>
          </tr>
          <tr bordercolor="#FFFFFF">
            <td><div align="right">Email:</div></td>
            <td bordercolor="#FFFFFF">
              <div align="justify">
                <input type="text" name="email" size="50">
              </div></td>
          </tr> 
                <input type="submit" name="Submit" value="注 册">
                <input type="reset" name="Submit2" value="重 写">
      

  2.   

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>    <script type="text/javascript">
        function Button1_onclick() 
        {
            var nameText=document.getElementById("nameText");
            var passwordText=document.getElementById("passwordText");
            var passwordText2=document.getElementById("passwordText2");
            var nicknameText=document.getElementById("nicknameText");
            var birthdayTextY=document.getElementById("birthdayTextY");
            var birthdayTextM=document.getElementById("birthdayTextM");
            var birthdayTextD=document.getElementById("birthdayTextD");
            var emailText=document.getElementById("emailText");
            
            if(nameText.id=="nameText")
            {
                if(nameText.value== "")
                {
                    document.getElementById("nameLabel").innerText="用户名不能为空";
                }
                else
                {
                    document.getElementById("nameLabel").innerText="";
                }
            }        if(passwordText.id=="passwordText")
            {
                if(passwordText.value=="")
                {
                    document.getElementById("passwordLabel").innerText="密码不能为空";
                }
                else  if(passwordText.value.length <6 || passwordText.value.length>16)
                {
                   document.getElementById("passwordLabel").innerText="密码不能小于6大天于16";
                }
                else
                {
                    document.getElementById("passwordLabel").innerText="";
                }
            }        if(passwordText2.id=="passwordText2")
            {
                if(passwordText2.value=="")
                {
                    document.getElementById("passwordLabel2").innerText="密码验证不能为空";
                }
                else  if(passwordText.value != passwordText2.value)
                {
                   document.getElementById("passwordLabel2").innerText="密码与密码验证不一样";
                }
                else
                {
                    document.getElementById("passwordLabel2").innerText="";
                }
            }
            
            if(nicknameText.id=="nicknameText")
            {
                if(nicknameText.value== "")
                {
                    document.getElementById("nicknameLabel").innerText="昵称不能为空";
                }
                else
                {
                    document.getElementById("nicknameLabel").innerText="";
                }
            }
            
            if(birthdayTextY.id=="birthdayTextY")
            {debugger
                var birthday=new Date();
                var dd = new Date(birthdayTextY.value+"/"+birthdayTextM.value+"/"+birthdayTextD.value);
                try
                {
                    if(birthdayTextY.value== "")
                    {
                        document.getElementById("birthdayLabel").innerText="生日不能为空";
                    }
                    else if(dd > birthday)
                    {
                        document.getElementById("birthdayLabel").innerText="生日不应比今天早";
                    }
                    else
                    {
                        document.getElementById("birthdayLabel").innerText="";
                    }
                }
                catch(exception)
                {
                    document.getElementById("birthdayLabel").innerText="生日应为日期格试";
                }
            }
            
            if(emailText.id=="emailText")
            {
                if(emailText.value=="")
                {
                    document.getElementById("emailLabel").innerText="eMail不能为空";
                }
                else
                {
                    var email=emailText.value.split("@");
                    if(email.length=="2")
                    {
                        if (emailText.value.charAt(0)=="." ||
                                    emailText.value.charAt(0)=="@"||
                                    emailText.value.indexOf('@', 0) == -1 ||
                                    emailText.value.indexOf('.', 0) == -1 ||
                                    emailText.value.lastIndexOf("@")==emailText.value.length-1 ||
                                    emailText.value.lastIndexOf(".")==emailText.value.length-1)
                                    {
                                        document.getElementById("emailLabel").innerText="eMail格试不对";
                                    }
                        else
                        {
                            document.getElementById("emailLabel").innerText="";
                        }
                    }
                    else
                    {
                        document.getElementById("emailLabel").innerText="eMail格试不对";
                    }
                }
            }
        }    </script>    <form id="form1" runat="server">
            <table cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td style="width: 5%">
                        用户名</td>
                    <td style="width: 10%">
                        <input id="nameText" type="text" style="width: 189px" /></td>
                    <td style="width: 30%">
                        <label id="nameLabel">
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>
                        密码</td>
                    <td>
                        <input id="passwordText" type="text" style="width: 189px" /></td>
                    <td>
                        <label id="passwordLabel">
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>
                        再次输入密码</td>
                    <td>
                        <input id="passwordText2" type="text" style="width: 189px" /></td>
                    <td>
                        <label id="passwordLabel2">
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>
                        昵称</td>
                    <td>
                        <input id="nicknameText" type="text" style="width: 189px" /></td>
                    <td>
                        <label id="nicknameLabel">
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>
                        生日</td>
                    <td>
                        <input id="birthdayTextY" type="text" style="width: 50px" />
                            年<input id="birthdayTextM" type="text" style="width: 50px" />
                            月<input id="birthdayTextD" type="text" style="width: 50px" />
                            日</td>
                    <td>
                        <label id="birthdayLabel">
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>
                        电子邮件</td>
                    <td>
                        <input id="emailText" type="text" style="width: 189px" /></td>
                    <td>
                        <label id="emailLabel">
                        </label>
                    </td>
                </tr>
            </table>
        </form>
        <input id="Button1" type="button" value="提交" onclick="return Button1_onclick()" />
    </body>
    </html>
      

  3.   

    日期控件没太整你要是要求的高就去
    http://www.happyshow.org/article.asp?id=5
    下就可以我下了可以有