<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Date of Birth calculator</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f4f8;
color: #333;
text-align: center;
}
header {
background-color: #4190e8;
padding: 1px;
color: white;
}
main {
margin: 20px;
}
input {
padding: 10px;
margin-top: 10px;
width: 250px; /* Set a width for the input */
border: 1px solid #ccc; /* Add a border */
border-radius: 5px; /* Rounded corners */
}
input::placeholder {
color: rgba(0, 0, 0, 0.5); /* Transparent placeholder text */
}
button {
padding: 5px 15px;
background-color: #4a90e2;
color: white;
border: none;
border-radius: 5px; /* Rounded corners for button */
cursor: pointer;
}
button:hover {
background-color: #357ab8;
}
.hidden {
display: none;
}
footer {
margin-top: 20px;
font-size: 14px;
}
</style>
</head>
<body>
<header>
<h1>Date of Birth calculator</h1>
</header>
<main>
<label for="dob">choose your date of birth:</label>
<input type="date" id="dob" name="dob" required>
<div>
<button id="submitBtn">Submit</button>
</div>
<div id="result" class="hidden">
<h2>Your Date of Birth:</h2>
<p id="dobOutput"></p>
</div>
<div id="copySection" class="hidden">
<input type="text" id="myInput" placeholder="Paste your DOB here" style="width: 250px; margin-top: 10px;">
<button onclick="copyText()">Copy</button>
</div>
</main>
<footer id="footer" class="hidden">
<p>© 2024 Award Winning Website by amar
</p>
</footer>
<script>
function copyText() {
const input = document.getElementById("myInput");
input.select();
document.execCommand("copy");
alert("Copied: " + input.value);
}
document.getElementById('submitBtn').addEventListener('click', function() {
const dobInput = document.getElementById('dob').value;
const resultDiv = document.getElementById('result');
const dobOutput = document.getElementById('dobOutput');
const copySection = document.getElementById('copySection');
const footer = document.getElementById('footer');
if (dobInput) {
dobOutput.textContent = dobInput; // Display the date of birth
resultDiv.classList.remove('hidden'); // Show the result section
copySection.classList.remove('hidden'); // Show the copy section
footer.classList.remove('hidden'); // Show the footer
} else {
alert('Please enter a valid date of birth.');
}
});
</script>
</body>
</html>