<title>无标题文档</title>
</head><body>                  
                  </p><form id="add_user" name="profile" action="baoming.php" method="post" onsubmit="return Checkreg();">
  <table class="form" id="AutoNumber1" style="border: 1px solid rgb(0, 0, 0); font-size: 9pt; border-collapse: collapse;" align="center" border="0" bordercolor="#787878" cellpadding="0" cellspacing="0" width="620" height="757">
                <tbody>
               
                  <tr>
                    <td colspan="3" class="px14" style="border-width: 1px; border-top: 1px solid rgb(0, 0, 128); border-left: 1px solid rgb(0, 0, 128); border-right: 1px solid rgb(0, 0, 128);" bgcolor="#999999" height="33"><p class="STYLE4 STYLE5" align="center"><font color="#000000"> 在 线 报 名 表 
                      </font></p></td>
                  </tr>                  <tr>
    <td align="right" bgcolor="#f0f0f0" width="104" height="27">报考第一志愿:</td>
    
    <td class="text" colspan="2" bgcolor="#f0f0f0"><span class="text"><select id="institute1" onchange="redirecta(this.options.selectedIndex);" name="xy"> <option value="" selected="selected"></option> <option>理 工 学 院</option> <option>文 法 学 院</option> <option>经 管 学 院</option> <option>环 保 学 院</option> <option>软 件 学 院</option></select> 学院 <select id="specialty1" onchange="redirect1a(this.options.selectedIndex)" name="zy" style="width: 110px;"> <option value="" selected="selected"></option></select> 专业 <select id="level1" name="xuezhi" style="width: 110px;"> 
                
                </tbody>
                </table></form>
<script language="javascript">
function Checkreg(){
if(!document.profile.xy.value){
alert('输入正确的学院名');
return false;
    }
if(!document.profile.zy.value || document.profile.zy.value=='请选择'){
alert('请选择正确的专业名');
return false;
}
if(document.profile.xuezhi.value == '---学历---' || !document.profile.xuezhi.value|| document.profile.xuezhi.value=='请选择'){
alert('请选择正确的学历');
return false;
}
//第一段的判断}
  </script>
</body>
</html>这个IE下不行,就是 if(!document.profile.xy.value){
alert('输入正确的学院名');
return false;
    }
if(!document.profile.zy.value || document.profile.zy.value=='请选择'){
alert('请选择正确的专业名');
return false;
}
if(document.profile.xuezhi.value == '---学历---' || !document.profile.xuezhi.value|| document.profile.xuezhi.value=='请选择'){
alert('请选择正确的学历');
return false;
}
选中也提示错误在FF没问题由于C SDN限制字数  很多写不上去  
 

解决方案 »

  1.   

    IE不支持用name做控件.
    建议全部改用document.getElementById("")
    IE和FF都兼容.
      

  2.   


    var cardid = document.profile.sfid.value;
    if(cardid.length!=15 && cardid.length!=18){alert("身份证位数不对"); return false;}
    //if(cardid.length!=18){alert("身份证位数不对"); return false;} 
    if(cardid.length==15)
    {
    pattern= /^\d{15}$/;//正则表达式,15位且全是数字
    if (pattern.exec(cardid)==null)
    {
    alert("15位身份证号码必须为数字!")
    return false;
    }
    }
    else if(cardid.length==18){
    pattern= /^\d{17}(\d|x|X)$/;//正则表达式,18位且前17位全是数字,最后一位只能数字,x,X
            if (pattern.exec(cardid)==null)
            {
                alert("18位身份证号码必须为数字!")
                return false;
            }
    }
    if (document.profile.minzu.value.length<1)
    {
                alert("请输入您的名族")
                return false; 但是我这些跑的了
      

  3.   

    id和name相同?
    建议别用这种方式.
    到另外的浏览器又不行的.
      

  4.   

    if(!document.profile.xy.value){ 
    alert('输入正确的学院名'); 
    return false; 
        } 改为if(document.getElementById('institute1').selectedIndex==0)
        {
            alert('输入正确的学院名');
            return false;
        }