I hope you can help.
I am trying to use a date format field in HTMl, which will then use this date in JavaScript. Once it reads the date, it will work whether it is within 3 months or not.
At the moment, it is coming back that an invalid date has been entered. How do I get JavaScript when using the HTML date format?
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; ICT5 & lt; / Title & gt; & Lt; Script & gt; Function Checkdate () {var UserDate = document.getElementById ("Date"). Values; Var Parts = Usadat. Split ("/"); Var dt = new date (part (part [2], 10), parsient (part [1], 10), parsient (part [0], 10)); Window.alert ("userdate" + dt); Var timestamp = new date (). GetTime (+) (90 * 24 * 60 * 60 * 1000); Window.alert ("+ timestamp"); If (Timestamp> DT) {Warning ("The selected time is less than 3 months from now on"); } Other {Warning ("The selected time is more than 3 months from now"); }} & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; ICT5 a & lt; / H1> & Lt; H1 & gt; Doing the difference between today and your selected date & lt; / H1> & Lt; P & gt; Please enter date & lt; / P & gt; & Lt; Input id = "date" type = "date" & gt; & Lt; Button type = "button" onclick = "checkdate ()" & gt; Submit & lt; / Button & gt; & Lt; / Body & gt; & Lt; / Html & gt;
No comments:
Post a Comment