Hi,
I need to test a dropdown and based on it's value take todays date and add a certain number of days to that date.
Here are the dropdown values and the number of days dependant on which is selected. See my code below.
Problem i have is this, what if the date is 30/07/2009 and i need to add 5 days on. The way i have it at the moment the result will look like 35/07/2009 which is no good i need it to work out the date logic and give methe result of 04/08/2009
Does anyone have any hints for this? Thanks in adavnce
Assessment = 2 days
Planned = 5 days
Active = 3 days
I need to test a dropdown and based on it's value take todays date and add a certain number of days to that date.
Here are the dropdown values and the number of days dependant on which is selected. See my code below.
Problem i have is this, what if the date is 30/07/2009 and i need to add 5 days on. The way i have it at the moment the result will look like 35/07/2009 which is no good i need it to work out the date logic and give methe result of 04/08/2009
Does anyone have any hints for this? Thanks in adavnce
Assessment = 2 days
Planned = 5 days
Active = 3 days
Code:
<script language="">
<!--
var today_date= new Date()
var month=today_date.getMonth()+1
var today=today_date.getDate()
var year=today_date.getFullYear()
function function1(Sales_Stage) {
var Sales_Stage = (Sales_Stage.options[Sales_Stage.selectedIndex].text);
if (Sales_Stage == "ASSESSMENT") {
alert((today+2)+"/"+month+"/"+year);
}
else if (Sales_Stage == "PLANNED") {
alert((today+5)+"/"+month+"/"+year);
}
else if (Sales_Stage == "ACTIVE") {
alert((today+3)+"/"+month+"/"+year);
}
}
-->
</script>
<select name="_sales_stage" id="_sales_stage" class=ScheduleActivityType onChange=function1(this); format=Text >
<option></option>
<option>ACTIVE</option>
<option>ASSESSMENT</option>
<option selected>PLANNED</option>
<option>REFERRAL</option>
</select>