File tree Expand file tree Collapse file tree
Example/If Else/if-else Statement Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+ < link href ="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css " rel ="stylesheet " integrity ="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH " crossorigin ="anonymous ">
8+ < script src ="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js " integrity ="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz " crossorigin ="anonymous "> </ script >
9+ < script src ="loginScript.js "> </ script >
10+ </ head >
11+ < body >
12+
13+ < div class ="container m-5 ">
14+ < div class ="row justify-content-center ">
15+ < div class ="col-sm-6 ">
16+ < h1 class ="fs-2 "> Login Now ! </ h1 >
17+ < form >
18+ < div class ="mb-3 ">
19+ < label class ="form-label "> Email address</ label >
20+ < input type ="email " class ="form-control " id ="username ">
21+ </ div >
22+ < div class ="mb-3 ">
23+ < label class ="form-label "> Password</ label >
24+ < input type ="password " class ="form-control " id ="password ">
25+ </ div >
26+ < button type ="button " class ="btn btn-primary " onclick ="login() "> Submit</ button >
27+ </ form >
28+ </ div >
29+ </ div >
30+
31+ </ div >
32+
33+
34+ </ body >
35+ </ html >
Original file line number Diff line number Diff line change 1+ function login ( ) {
2+
3+ let u_name = document . getElementById ( "username" ) . value ;
4+ let u_pwd = document . getElementById ( "password" ) . value ;
5+
6+ if ( u_name == "admin" && u_pwd == "admin@123" ) {
7+
8+ window . open ( "welcome.html" )
9+
10+ } else {
11+ alert ( " wrong password try again ... " )
12+ }
13+
14+
15+ }
You can’t perform that action at this time.
0 commit comments