Q:

Add day(s) in a date in Javascript

I have textbox displaying date and have a button. the function in button is to add 7 days and display in textbox. my code:
 function onNext() {    
    var startdate = document.getElementById('date').value;
    var addday = new Date(startdate);
    var dd = addday.getDate() + 7;
    var mm = addday.getMonth() + 1;
    var y = addday.getFullYear();
    var displaydate = y + '/' + mm + '/' + dd;
    document.getElementById('date').value = displaydate ;
}

The issue how to add a day to go to the next month. 
Example the date in Textbox is 2014/08/25 when I click the button the date will be 2014/09/01

A:

Just add 7 days to your date, date already handles change of month/year:
 function onNext() {    
    var startdate = document.getElementById('date').value;
    var addday = new Date(startdate);
    addday.setDate(addday.getDate() + 7);
    var dd = addday.getDate() + 7;
    var mm = addday.getMonth() + 1;
    var y = addday.getFullYear();
    var displaydate = y + '/' + mm + '/' + dd;
    document.getElementById('date').value = displaydate ;
}

