I encountered an issue where the script I used in my HTML file didn't work as expected. The purpose of this script was to prevent users from submitting a date greater than today's date. Interestingly, when I copied the same script to another HTML file, it worked perfectly fine. It seems like there is something specific to this particular HTML file that is causing the problem.
function checkform() {
answ = validateDate(document.getElementById("doa").value);
if (answ == false) {
return false;
} else {
return true;
}
}
function validateDate(doa) {
var d = new Date(doa);
var n = new Date();
if (d >= n) {
alert("Date cannot be greater than today.");
return false;
}
return true;
}
.welcome {
font-weight: bold;
font-family: Calibri;
width: 100%;
text-align: center;
}
.rating {
text-align: center;
}
.particulars {
text-align: center;
font-weight: bold;
font-style: italic;
}
...
...
<head>
...
...
</body>
I am curious to investigate the reason behind the malfunction of the script in my HTML file. Your insights would be greatly appreciated.
Warm regards, Mark