I want to create a web form that automatically has the current date and the previous date as the default. Basically I want the form to have the last 24 hrs as the default date range for the form. It was suggested that I use javascript. I dont know much about javascript so this is what I have so far:
My problem is that I don't know how to generate a dropdown menu from this information. My current HTML code looks like this:
I want to keep the values I set because they are in the format needed to create reports from the form. How do I automatically set the current and previous date while still maintaining the values needed for the reports?
Code:
datecount=1;
var cur_dat=new Date();
curdate=cur_dat.getDate();
var diff_dat=new Date();
diff_dat.setDate(curdate-datecount);
My problem is that I don't know how to generate a dropdown menu from this information. My current HTML code looks like this:
Code:
<select name="month">
<option value="01">January</option>
<select name="day">
<option value="01">1</option>
<select name="year">
<option value="08">2008</option>
I want to keep the values I set because they are in the format needed to create reports from the form. How do I automatically set the current and previous date while still maintaining the values needed for the reports?