Days between today and input date (Date Math

So this is a homework assignment. I'm really bad at JavaScript and need more than just suggestions and hints.

1. input from a single entry field of a validated date in mm/dd/yyyy format. You only need to validate the date format, not that it is a valid date. The associated output area will display the current date in mm/dd/yyyy format, the date that was input and the number of days between the two dates. Be sure to indicate which date was input and which is the current date.

2. Will take a validated number from 10-99 from a single entry field. The associated output area will display a random whole number from 1 to a maximum of the number input.
3. Will take input from two text fields. The associated output area will display the content of both input fields and an indication if the input from field one is a substring of the input from field two.

This is as far as I've gotten
Code:
```<script type = "text/javascript">

function checkit() {

var d1 = document.myform.date1.value.split("/");
var yr = d1[2];
var mm = d1[1]-1;
var dy = d1[0];
var OK1 = checkValidDate(yr,mm,dy);
if ((yr < 0001|| yr > 9999)) {OK1 = false}

var d2 = document.myform.date2.value.split("/");
var date1 = new Date();
var yr = date1.getFullYear();
var mm = date1.getMonth();
var dy = date1.getDate();

if ((!OK1) || (!OK2)) {
document.myform.date1.value = "";
document.myform.date2.value = "";
return false;
}

var firstDate = new Date(d1[2],d1[1]-1,d1[0]);
var secondDate = new Date(d2[2],d2[1]-1,d2[0]);

function daysBetween(startDate,stopDate) {
var ONE_DAY = 1000 * 60 * 60 * 24;  // The number of milliseconds in one day
var dx_ms = startDate.getTime();  // Convert both dates to milliseconds
var dy_ms = stopDate.getTime();
// Calculate the difference in milliseconds
var difference_ms = Math.abs(dy_ms - dx_ms);
// Convert back to days and return
return Math.round(difference_ms/ONE_DAY);
}

alert("Days between the two dates is " + daysBetween(firstDate,secondDate));
}

</script>