I've got a script that gives me 2 dates in input boxes. 1 is for the current date and the other is for a date of six months in the future. I would like this future date to only populate in the text box if a checkbox is checked. One catch, the future box may already have a date in there so when checked it would have to override this value with the new 6 month date. Here is what I have thanks for the help:
<html>
<HEAD>
<script type="text/javascript">
Date.prototype.addMonths = function (m) {
var d = new Date (this.getTime())
d.setMonth (d.getMonth() + m)
return d
}
True, the code I posted presumed that the first date would be filled in already.
That code calculates a six-month offset from the date in the first box.
Ok, I did get it to work however the box doesn not actually check is it possible to have the box actually check when you click on it.
Thank for the help here is what I've got:
<html>
<HEAD>
<script type="text/javascript">
Date.prototype.addMonths = function (m) {
var d = new Date (this.getTime())
d.setMonth (d.getMonth() + m)
return d
}
Yep, I did it that way so that it is easier to calculate and re-calculate a six-month offset repeatedly.
The following is changed to go back to the normal function:
I have to have this:
<body onload="initial_update();">
for my other script so I will have to add the date onload function to the body tag and not the actual script and I'm not sure how to do that. Any suggestions.
Bookmarks