Monday, 16 September 2024

WRITE A JAVASCRIPT TO USER ENTERED DATE IS FUTURE DATE OR PAST DATE

 <html>

<head>

<title></title>

</head>

<body>

<h2>Print the day of the month from the system and user entered dates</h2>

Enter Date: <input type="date" name="dt_date" id="dt_date"> <br/>

<input type="submit" value="Click Me" onclick="myFunction()"/>

<script language="JavaScript">

function myFunction() {

var date = new Date();


mydate=new Date(document.getElementById('dt_date').value);


if(date < mydate) {

  alert(" The given date is Future Date");

}

else {

alert("The given date is Past Date");

}

}

</script>

</body>

</html>

No comments:

Post a Comment