-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialog_boxes.html
33 lines (27 loc) · 1007 Bytes
/
dialog_boxes.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
29
30
31
32
33
<!doctype html>
<html lang="en">
<head>
<title>Dialog Box</title>
</head>
<body>
<p><button id="Alert">Alert</button></p>
<p><button id="Confirm">Confirm</button></p>
<p><button id="Dialog">Dialog</button></p>
<script>
const alertbtn = document.getElementById("Alert");
const confirmbtn = document.getElementById("Confirm");
const dialogbtn = document.getElementById("Dialog");
alertbtn.addEventListener("click", () => {
alert("You have clicked alert!");
})
confirmbtn.addEventListener("click", () => {
let userResp = confirm("Do you want to continue?");
alert("You gave response " + userResp);
})
dialogbtn.addEventListener("click", () => {
let userResp = prompt("What is your name?")
alert("Your name is " + userResp);
})
</script>
</body>
</html>