File tree Expand file tree Collapse file tree 4 files changed +80
-0
lines changed
Expand file tree Collapse file tree 4 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+
4+ < head >
5+ < meta charset ="UTF-8 ">
6+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
7+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
8+ < title > pop-up JS</ title >
9+ < link rel ="shortcut icon " href ="images/js-logo.png " type ="image/x-icon ">
10+ < link rel ="stylesheet " href ="style.css ">
11+ </ head >
12+
13+ < body >
14+ < h1 > Pop-Up in JavaScript</ h1 >
15+ < h2 > There are three types of pop-up in JS Click on each button to check the pop-ups</ h2 >
16+ < button onclick ="firstDisplay() "> Confirm Box</ button >
17+ < button onclick ="secondDisplay() "> Prompt</ button >
18+ < button onclick ="thirdDisplay() "> Alert</ button >
19+ < script src ="script.js "> </ script >
20+ </ body >
21+
22+ </ html >
Original file line number Diff line number Diff line change 1+ /*
2+ There are three types of pop-ups in JavaScript
3+ 1. Confirm Box
4+ 2. Prompt
5+ 3. Alert
6+
7+ Understand the Examples Below to get Acknowledged about pop-ups
8+ */
9+ function firstDisplay ( ) {
10+ window . confirm ( "Are you enjoying nowadays?" )
11+ if ( confirm ( "Press a button!" ) ) {
12+ txt = "You pressed OK!" ;
13+ } else {
14+ txt = "You pressed Cancel!" ;
15+ }
16+ }
17+
18+ // Example 2 we will discuss about prompt
19+
20+ function secondDisplay ( ) {
21+ let person = window . prompt ( "What is your Name?" ) ;
22+ let text ;
23+ if ( person == null || person == "" ) {
24+ alert ( "Don't Try to Skip, Click on Second Button and Enter your Name" ) ;
25+ } else {
26+ alert ( "Thanks " + person + "!" )
27+ console . log ( person )
28+ }
29+ }
30+
31+ // Example 3 is very simple and which is alert
32+
33+ function thirdDisplay ( ) {
34+ alert ( "Enjoy your Day!" )
35+ }
Original file line number Diff line number Diff line change 1+ h1 {
2+ font-family : sans-serif;
3+ }
4+
5+ h2 {
6+ font-family : cursive;
7+ }
8+
9+ button {
10+ font-size : 22px ;
11+ margin : 0px 10px ;
12+ background-color : transparent;
13+ cursor : pointer;
14+ border-radius : 5px ;
15+ padding : 10px 15px ;
16+ font-weight : 700 ;
17+ transition : all ease 0.5s ;
18+ }
19+
20+ button : hover {
21+ background-color : black;
22+ color : white;
23+ }
You can’t perform that action at this time.
0 commit comments