dsf55s1233 2010-07-22 08:10
浏览 33
已采纳

限制密码字符

i have a simple question..

in registration script.. how can i set the limit character of a password. sample: minimum character is 6.. so what will be the code. please help me. :-(

  • 写回答

5条回答 默认 最新

  • dongzuo7166 2010-07-22 08:12
    关注

    Javascript code:

    var el = document.getElementById('field_id');
    
    if (el.value.length >= 6)
    {
      alert('OOps');
    }
    

    PHP Code:

    if (strlen($_POST['field_name']) >= 6)
    {
      // more than six chars entered !!
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?