<!DOCTYPE html>
<html>
<head>
<title>Voting</title>
<style>
body {
height:630px;
background:linear-gradient(to bottom,orange,white,green)
}
h1{
text-align: center;
font-family:cursive;
font-size:50px;
text-decoration:underline;
}
input{
margin-left:25%;
width:50%;
height:50px;
font-size:30px;
border: solid black 2px;
border-radius:10px;
text-align: center;
}
button{
margin-left:40%;
margin-top:30px;
width:20%;
height:40px;
font-size:25px;
border: solid black 2px;
border-radius:10px;
text-align: center;
}
h1#output{
font-size:45px;
text-decoration:none;
}
</style>
</head>
<body>
<h1>Enter Your Age :-</h1><br />
<input id="age"type="number"placeholder="Enter Your Age"></input><br /><br />
<button onclick="vote();">Check</button>
<br /><br /><br />
<h1 id="output"></h1>
<script>
function vote()
{
var check=document.getElementById("age").value;
if(check>=18)
{
document.getElementById("output").innerHTML="You Can Vote";
}
else
{
document.getElementById("output"). innerHTML="You Cannot Vote";
}
}
</script>
</body>
</html>
OUTPUT
Comments
Post a Comment