never programmed in JavaScript before, so I ask your assistance to display the expiry date when user chooses start and end date from the calendar. After selecting the end date from the calendar, the expiry date should display added two months to the end date. For example: The user chooses Oct. 9, 2012 as Start Date; Oct. 16, 2012 as the end date; Dec. 16, 2012 should be the expiry date. How can I achieve this in JavaScript?

Please check this code, cause I don't know how to edit this one.

/**
* Click "Cal" on expiry date
*/
function getExpiryDate() {
if(!document.getElementById('enddate').value.length) {
alert("End date must be set first.");
}
else {
prevExpiryDate = document.getElementById('expirydate').value;
displayCalendar(document.forms[0].expirydate,'yyyy/mm/dd',
    document.getElementById('expirydatebutton'));
 }
}

The requirement needs to be clarified first. What is the expiry date if the end date is July 31? Would it be September 30? Or would it be October 1?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.