I'm trying to make a calendar where the frost date is input and based on this date, a list of other dates are calculated that will be specific times from the input date. I have minimal programming skills and would appreciate any help.
I've gotten code that will input the frost date and output a single date (6 weeks prior to this date = tomato planting date). I wish the output button was a list of dates, or there were multiple buttons that pop up..... Maybe someone could help with adding one more date line and I can figure out how to repeat. Or direct me to the function I need to research more. Thanks!
test site: http://bioarray.us/generate%20planti...=5&d1=20&m1=10
code so far:
I've gotten code that will input the frost date and output a single date (6 weeks prior to this date = tomato planting date). I wish the output button was a list of dates, or there were multiple buttons that pop up..... Maybe someone could help with adding one more date line and I can figure out how to repeat. Or direct me to the function I need to research more. Thanks!
test site: http://bioarray.us/generate%20planti...=5&d1=20&m1=10
code so far:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form>
<p>
<input type="text" name="date1" size="20">
<br>
Date of last spring frost (mm/dd/yyyy)<br>
Enter month and day of the latest spring frost in your garden in the past 5 years or so. If you don't know this, use the date from <a href="http://www.burpee.com/ancillary/zonefinder.do">Burpee</a> or <a href="http://cdo.ncdc.noaa.gov/cgi-bin/climatenormals/climatenormals.pl?directive=prod_select2&prodtype=CLIM2001&subrnum">NOAA</a>. For year, enter this year - 2009.
<br>
<br>
<input type="button" value="Generate planting calendar!"
onclick="finddates(this);" />
</p>
<p> </p>
<p>
<input type="text" name="date2" size="20" readonly>
Sow tomato seed indoors.<br>
<br>
<br>
</p>
</form>
<script type="text/javascript">
document.forms(0).date1.value = dateToString(new Date())
function dateToString(d){
return [d.getMonth()+1,d.getDate()].join('/')
}
function finddates(x){
d = new Date(x.form.date1.value)
d = new Date(d.getYear(),d.getMonth(),d.getDate()-40)
x.form.date2.value = dateToString(d)
}
</script>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
</body>
</html>
Comment