maddirala
08-03-2004, 07:08 PM
Hi
I need to validaemy passwoed.it should be 8 characters and must not contain part(letters in username) of user name.
can anyone giveme idea or code.
i have tried foloowing this
<script language="JavaScript">
function goAdd(form1){
if(form1.userName.value == null || form1.userName.value.length <8 ){
alert('Please fill in the User Name.');
form1.userName.focus();
return false;
}
if(form1.password.value == null || form1.password.value.length == 0){
alert('Please fill in the Password.');
form1.password.focus();
return false;
}
for(i = 0 ; i < form1.userName.value.length ; i++){
var str = form1.userName.value.substring(i , form1.userName.value.length);
alert(str);
if (form1.userName.value.indexOf(form1.password.value) == -1) {
if (str.indexOf(form1.password.value) == -1) {
alert('Valid Password');
return true;
}else{
alert('Incorrect Password.');
return false;
}
} }
}
</script>
thanks for anyhelp
I need to validaemy passwoed.it should be 8 characters and must not contain part(letters in username) of user name.
can anyone giveme idea or code.
i have tried foloowing this
<script language="JavaScript">
function goAdd(form1){
if(form1.userName.value == null || form1.userName.value.length <8 ){
alert('Please fill in the User Name.');
form1.userName.focus();
return false;
}
if(form1.password.value == null || form1.password.value.length == 0){
alert('Please fill in the Password.');
form1.password.focus();
return false;
}
for(i = 0 ; i < form1.userName.value.length ; i++){
var str = form1.userName.value.substring(i , form1.userName.value.length);
alert(str);
if (form1.userName.value.indexOf(form1.password.value) == -1) {
if (str.indexOf(form1.password.value) == -1) {
alert('Valid Password');
return true;
}else{
alert('Incorrect Password.');
return false;
}
} }
}
</script>
thanks for anyhelp