1.<input type='radio' name='ps_card_type' value='a'  tabindex='5'>
2.<input type='radio' name='ps_card_type' value='b'  tabindex='5'> <td align="right" class="tableThird">ID number &nbsp;</td>
          <td>
                    &nbsp;<input name="ps_person_id" type="text" class="TextBox" size="30" maxlength="18" value='' tabindex='6'></td>是2个单选点...
...当我选择1的时候...如果ID number里 的长度 不=15 则 跳出错误
当我选择2的时候...如果ID number里的 常度 不=18  则跳出错误..这个javascript怎么编啊...

解决方案 »

  1.   

    具体效果如下~
    https://passport.the9.com/register/ctl_register.php?action=reg_loginname
      

  2.   

    1.<input type='radio' name='ps_card_type' value='a' tabindex='5' 
    onclick=func(this.value)>
    2.<input type='radio' name='ps_card_type' value='b' tabindex='5'
     onclick=func(this.value)>
    function func(a){
       if(a=='a'){
          if(document.getElementsByName('ps_person_id')[o].value.length 
     != 15){
            alert('err')
          }
       }
       if(a=='b'){
          if(document.getElementsByName('ps_person_id')[o].value.length 
     != 18){
            alert('err')
          }
       }
    }