If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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.

More observations, you have name = "date1" but no name = "date2" field, you make reference to it in your script.

Your HTML code should have no spaces between the name and the value in the tags, example <input type = "text" name = "date1" id = "date1"> should be <input type="text" name="date1" id="date1" />

You should have it value="" for the inputs. It prevents errors in code for example Google Chrome wouldn't run because the form fields had no value="" set and the only other option was to use the getElementbyId method, when I put in the value="" then the more direct reference to the document.myform.date1.value worked.

STOP using $ prefix on JavaScript variable names...
Please remember to wrap any code you have in forum tags:- [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]If you can't think outside the box, you will be trapped forever with no escape...

More observations, you have name = "date1" but no name = "date2" field, you make reference to it in your script.

Your HTML code should have no spaces between the name and the value in the tags, example <input type = "text" name = "date1" id = "date1"> should be <input type="text" name="date1" id="date1" />

You should have it value="" for the inputs. It prevents errors in code for example Google Chrome wouldn't run because the form fields had no value="" set and the only other option was to use the getElementbyId method, when I put in the value="" then the more direct reference to the document.myform.date1.value worked.

STOP using $ prefix on JavaScript variable names...
Please remember to wrap any code you have in forum tags:- [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]If you can't think outside the box, you will be trapped forever with no escape...