这有什么啊 跟你写的判断一样啊if   (va=="person")   就判断他相关的
if   (va=="org")   判断他相关的 

解决方案 »

  1.   

    拼写错误                 <select name="sq_type" onChange="javascript:showco(this.value);">
                      <option   value="persion">公民</option>
                      <option   value="org">法人或其他组织</option>
                    </select>
    改成                <select name="sq_type" onChange="javascript:showco(this.value);">
                      <option   value="person">公民</option>
                      <option   value="org">法人或其他组织</option>
                    </select>
      

  2.   

    按4楼的改你的错误,然后验证的结构如下
    <form action="" method="post" onsubmit="return check(this)">
     function check(f)
      {
        if(f.sq_type.value=="person")//公民,然后需要验证那些在下面的括号里面填写
        {}
        else//法人的,然后需要验证那些在下面的括号里面填写
        {}
      }
      

  3.   

    为空验证:
    function $(o) { return document.getElementById(o);}function checkInput(sel){   //传当前选中的option的value值
      var clientDiv=$(sel);
      var test=false;  
      var inputArray=clientDiv.getElementsByTagName("input");  for(var i=0;i<inputArray.length;i++){
         if(inputArray[i].type=='text') {
            //这里就可以做为空判断 并处理
         }
      }  return test;
    }
      

  4.   

    要验证什么?如果验证为空,很简单的
    你要使用JS在提交时验证数据是吧?document.getElementsByName("sq_type")[0].checked这个表示选的是公民
    document.getElementsByName("sq_type")[1].checked这个表示选的是法人或其他组织那么你可以这么做判断
    if(document.getElementsByName("sq_type")[0].checked){
    //在这里做公民的信息数据验证
    }else if(document.getElementsByName("sq_type")[1.checked){
    //在这里做判断法人的信息数据验证
    }
      

  5.   

    <html <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>政府信息公开</title>
    <link href="index.css" rel="stylesheet" type="text/css">
    <script   language="javascript">   
      function   showco(va)   
      {     
      if   (va=="person")   
      {     
      person.style.display='';     
      org.style.display='none';
      if(form1.Pname.value=""){
      
      alert("请输入正确姓名");
      }     
      }   
      if   (va=="org")   
      {     
      person.style.display='none';   
      org.style.display='';   
      }   
        
      if   (va=="")   
      {     
      person.style.display='none';   
      org.style.display='none';   
      }   
      }  
      </script>
    <script language="javascript">function checkform(f)
      {
      alter("ffffffff");
          if(f.sq_type.value=="person")//公民,然后需要验证那些在下面的括号里面填写
        {
    if(f.pname.value==""){

    alter("panem");
    }
    }
        else//法人的,然后需要验证那些在下面的括号里面填写
        {}
      }
     
    </script>
    </head>
    <body bgcolor="#FFFFFF">
    <table width="1004" border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
      <tr>
        <td height="28" valign="middle" bgcolor="0073ca"><table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="2%">&nbsp;</td>
              <td width="14%"><a href="index.asp"><font color="#FFFFFF"><b>网站首页</b></font></a> <font color="#FFFFFF">|</font> <a href="/lcxzfxxgk/LoginForm.aspx" target="_blank"><font color="#FFFFFF"><b>报送入口</b></font></a></td>
              <td width="84%" align="right" valign="middle">&nbsp;</td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td height="14" valign="top" background="img/Top_bottom_bg.gif">&nbsp;</td>
      </tr>
    </table>
        <form action="ok.asp" method="post" onsubmit="return checkform(this);">
              </form>
    </body>
    </html>
    为什么验证没有反映?