-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
95 lines (82 loc) · 3.02 KB
/
index.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
89
90
91
92
93
94
95
<!DOCTYPE html>
<html lang="en">
<head>
<title>Love Calculator</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>
body{
background-image: linear-gradient(rgba(0,0,0,0.3),rgba(0,0,0,0.3)), url('https://images.pexels.com/photos/1028725/pexels-photo-1028725.jpeg');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
width: 100%;
height: 100vh;
position: relative;
}
header{
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
</style>
</head>
<body>
<header>
<div class="card w-50 m-auto text-center">
<div class="card-header bg-danger text-white">Love Calculator</div>
<div class="card-body">
<form class="form-inline w-75 m-auto">
<div class="form-group">
<input type="text" name="" class="form-control text-center" placeholder="Your Name" id="name">
</div>
<div> <span class="pl-4 pr-4"> + </span> </div>
<div class="form-group">
<input type="text" name="" class="form-control text-center" placeholder="Love Name" id="lname">
</div>
</form>
<br>
<div class="w-75 m-auto">
<button class="btn btn-success w-50" onclick="checkloveper()" id="cbtn"> Calculate </button>
</div>
<br>
<div>
<input type="text" name="" id="lovevalue" class="form-control text-center w-25 m-auto" placeholder="Love Percentage">
</div>
</div>
<footer class="card-footer">May God bless your Relationship</footer>
</div>
</header>
<script>
function checkloveper(){
var name=document.getElementById('name').value;
var lname=document.getElementById('lname').value;
if(name == ""){
alert('Please enter your name');
}
else if(name.length <=2){
alert('Minimum length should be 3');
}
else if(!isNaN(name)){
alert('Numbers are not allowed');
}
else if(lname == ""){
alert('Please enter your lname');
}
else if(lname.length <=2){
alert('Minimum length should be 3');
}
else if(!isNaN(lname)){
alert('Numbers are not allowed');
}
else{
var lovedata = Math.random()*100;
lovedata = Math.ceil(lovedata);
document.getElementById('lovevalue').value =lovedata + "%";
}
// document.getElementById('cbtn').disabled = true;
}
</script>
</body>
</html>