html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!--ABOUT CODE :
The code validates following things :
1.Range = Username = 6-15
= Password = 6-10
2.Username does not contain :
Uppercase alphabets, blank spaces or
symbols
3.Password does not contain :
Blank space or Symbols viz (,),{,},[,],<,
>,#,,,*,?,:-->
<!--All suggestions are welcum😃😃😃
Help to make it better-->
<html><head>
<title>Username and Password</title></head>
<body bgcolor="gold"><h3>
<form name="f1"><center><br><br>
🌹--WELCOME--🌹<br><br>
VALIDITION OF USERNAME & PASSWORD<br><br>
ENTER USERNAME : <input placeholder=" eg:mark224" name="t1"><br><br>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
form,input
{
border-style:double;
color: red;
font-family:serif;
background-color: white;
border-bottom-right-radius:200px;
}
*{outline:none ;}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function f()
{var a,al,b,bl,x,y,p,q,r,s;
a=f1.t1.value;
al=a.length;
b=f1.t2.value;
bl=b.length;
x=0;y=0;
if(al<6 || al>15){alert("\nUSERNAME INVALID! :\n\nMinimum 6 characters, maximum 15 characters acceptable");x++;}
if(bl<6 || bl>10){alert("\nPASSWORD INVALID! :\n\nMinimun 6 characters,maximum 10 characters acceptable");y++;}
for(p=0;p<al;p++)
{q=a.charAt(p);
if((q<"a"||q>"z")&&(q<"0"||q>"9"))
{alert("\nUSERNAME INVALID!:\n\nBlank spaces or Uppercase alphabets or symbols not allowed.");x++;p=al;}}
for(r=0;r<bl;r++)
{s=b.charAt(r)
if(s==" "||s==":" || s=="(" ||s==")" ||s=="[" ||s=="]"||s=="{"||s=="}"||s==","||s=="." ||s=="#"||s=="<"||s==">"||s=="?"||s=="*")
{alert("\nPASSWORD INVALID:\n\n Blank space or Symbols viz (,),{,},[,],<,>,#,,,*,?,: not allowed");y++;r=bl;}}
if(x==0&&y==0){alert("VALIDATE SUCCESSFUL!");}
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Uruchom