-
Notifications
You must be signed in to change notification settings - Fork 3
/
otp.html
88 lines (77 loc) · 2.42 KB
/
otp.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
#main{
margin-top: 10%;
text-align: center;
justify-content: center;
}
#otp {
width: 130px;
margin: auto;
}
#otp>button{
display: flex;
background-color: teal;
width: 130px;
height: 30px;
color: white;
font-size: 17px;
cursor: pointer;
text-align: center;
}
#mobile{
display: inline-flex;
font-weight: bold;
}
h2{
color: blue;
text-align: center;
}
p{
text-align: center;
align-content: center;
}
#id01{
display: block;
}
.w3-container{
height: 250px;
}
</style>
<body>
<div id="id01" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="document.getElementById('id01').style.display='none'"
class="w3-button w3-display-topright">×</span>
<div id="main">
<h2>Get and Verify OTP for Payment</h2>
<p>Click below to get 4 digit One Time Password (OTP)
on your Mobile Number +91<span id="mobile"></span> via SMS</p>
<div id="otp">
<button>Generate OTP</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
document.querySelector("#otp").addEventListener("click", generateotp)
function generateotp(e) {
e.preventDefault()
var otp= Math.floor(Math.random() * 10000)
alert("otp" + " " + otp)
localStorage.setItem("otp",JSON.stringify(otp))
window.location.href="verifyotp.html"
}
var number = JSON.parse(localStorage.getItem("userdata"))[0]
console.log(number)
document.querySelector("#mobile").innerHTML = number
</script>