File tree Expand file tree Collapse file tree
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 > Advanced DOM js project</ title >
7+ < title > Student Result Checker</ title >
8+ < link rel ="stylesheet " href ="style.css ">
9+ </ head >
10+ < body >
11+ < h2 > Student Result Checker</ h2 >
12+ < input type ="number " id ="marks " placeholder ="Enter marks ">
13+ < br > < br >
14+ < button id ="checkBtn "> Check Result</ button >
15+ < p id ="result "> Result will appear here</ p >
16+ < script src ="script.js "> </ script >
17+ </ body >
18+ </ html >
Original file line number Diff line number Diff line change 1+ let marks = document . querySelector ( "#marks" ) ;
2+ let button = document . querySelector ( "#checkBtn" ) ;
3+ let resultpara = document . querySelector ( "#result" ) ;
4+ button . addEventListener ( "click" , function ( ) {
5+ let mark = Number ( marks . value ) ;
6+ if ( marks . value === "" ) {
7+ resultpara . innerText = "Please enter your marks." ;
8+ resultpara . className = "error" ;
9+ return ;
10+ }
11+ if ( mark >= 50 ) {
12+ resultpara . innerText = "PASS ✅" ;
13+ resultpara . className = "pass" ;
14+ }
15+ else {
16+ resultpara . innerText = "FAIL ❌" ;
17+ resultpara . className = "fail" ;
18+ }
19+ } )
Original file line number Diff line number Diff line change 1+ body {
2+ font-family : Arial, sans-serif;
3+ }
4+ .pass {
5+ color : green;
6+ font-weight : bold;
7+ }
8+ .fail {
9+ color : red;
10+ font-weight : bold;
11+ }
12+ .error {
13+ color : orange;
14+ }
You can’t perform that action at this time.
0 commit comments