-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
executable file
·117 lines (89 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="./img/favicon.png">
<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css2?family=Dosis:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./css/style.css">
<title>Palindrome || Mrh Rifat</title>
</head>
<body>
<section class="master">
<div class="container">
<div class="row">
<div class="col-md-12 main">
<div class="content">
<div class="bg">
<h3>Palindrome Checker</h3>
<form class="form">
<div class="form-group text">
<label>Enter your value</label>
<small>(Number, Name)</small>
<input type="text" id="getValue" class="form-control" placeholder="Ex: 121 / Era ">
</div>
<div>
<button class="btn btn-primary" onclick="palindromeNumber()">Check
Value</button>
</div>
<div class="form-group date">
<label>Enter your date</label>
<small>(Choose date)</small>
<input type="date" id="getDate" class="form-control">
</div>
<div>
<button class="btn btn-success " onclick="palindromeDate()">Check Date</button>
</div>
<div class="footer-section">
<p>
Don't you know what is Palindrome ?
</p>
<a href="https://en.wikipedia.org/wiki/Palindrome" target="_blank">Click Here</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<script>
//Date Function
function palindromeDate() {
var inputDate = document.getElementById("getDate").value;
var makeString = inputDate.toString();
var dateNoHyphens = makeString.replace("-", "");
var dateNoHyphens2 = dateNoHyphens.replace("-", "");
var reverse = dateNoHyphens2.split("").reverse().join("");
if (inputDate.trim() == '') {
return alert("Please select a date !");
} else {
if (reverse === dateNoHyphens2) {
return alert(inputDate + " (Year/Month/Day) is a Palindrome Value");
} else {
return alert(inputDate + " (Year/Month/Day) is not a Palindrome Value");
}
}
}
//Number Function
function palindromeNumber() {
var inputValue = document.getElementById("getValue").value;
var reverse = inputValue.split("").reverse().join("");
if (inputValue.trim() == '') {
return alert("Please input a number");
} else {
if (reverse === inputValue) {
return alert(inputValue + " is a Palindrome Value");
} else {
return alert(inputValue + " is not a Palindrome Value");
}
}
}
</script>
<script type="text/javascript" src="js/jquery-slim.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>
</html>