I am new to working with dates. I am trying to get this script to work. I am trying to get the T1.value to be increased by 7 days based on the variable id. <script type="text/javascript"> function isdate() { with (document.forms[0]) { var id = chosendate.value; T29.value = id T1.value = id.setDate(id.getDate()+7) } } </script> Thanks for any assistance. David
If chosendate is displayed as "m/d/y", try <script type="text/javascript"> function isdate() { with (document.forms[0]) { var tmp = chosendate.value.split("/"); var id = new Date(tmp[2].valueOf(), tmp[0].valueOf(), tmp[1].valueOf()); T29.value = id T1.value = id.setDate(id.getDate()+7) } } </script>
Hello, thanks for the response. However, I am getting an Object doesn't support this property or method David
Hello, I believe I have this script working...but I do not know how to format T1 back to mm/dd/yyyy <script type="text/javascript"> function isdate() { with (document.forms[0]) { var chdate = new Date(chosendate.value); var dd = chdate.getDate(); var mm = chdate.getMonth()+1;//January is 0! var yyyy = chdate.getFullYear(); var caldate = mm+'/'+dd+'/'+yyyy; T29.value = caldate T1.value = chdate.setDate(chdate.getDate()+7); } } </script> David
Hello, the script below is about as far as I can go... <script type="text/javascript"> function isdate() { with (document.forms[0]) { var chdate = new Date(chosendate.value); T29.value = chosendate.value; T1.value = (chdate.getMonth()+1)+'/'+chdate.setDate(chdate.getDate()+7)+'/'+chdate.getFullYear() T2.value = (chdate.getMonth()+1)+'/'+chdate.setDate(chdate.getDate()+14)+'/'+chdate.getFullYear() T3.value = (chdate.getMonth()+1)+'/'+chdate.setDate(chdate.getDate()+21)+'/'+chdate.getFullYear() T4.value = (chdate.getMonth()+1)+'/'+chdate.setDate(chdate.getDate()+28)+'/'+chdate.getFullYear() } } </script> for the dd I am getting a result like...1/1296190800000/2011 Any help would be appreciated. Thanks David