Skip to content

Instantly share code, notes, and snippets.

@grampelberg
Forked from hikahi/gist:49575
Created January 20, 2009 18:29
Show Gist options
  • Save grampelberg/49589 to your computer and use it in GitHub Desktop.
Save grampelberg/49589 to your computer and use it in GitHub Desktop.
datesmatch = 0
datesnomatch = 0
function travelDates () {
dateArray = new Array();
for (i=0; i < document.getElementsByName("date").length; i++) {
dateArray[i] = new Date(document.getElementsByName("date")[i].value);
}
for (i=0; i < dateArray.length - 1; i++) {
if (dateArray[i] < dateArray[i+1]) {
alert ("good");
datesmatch++;
} else {
alert ("bad");
datesnomatch++;
}
}
if datesmatch > datesnomatch {
clearfields = badDates
} else {
errorfields = baddates
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment