943,633 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 9352
  • JSP RSS
Oct 27th, 2005
0

dateadd function

Expand Post »
I have 2 text field in a form.
1st field for input date.
I want to use onclick event handler for 2nd text field. When user click 2nd text field then show up the value of 10 days before the input date in 1st field. how do i do that?
I try this:
<input type="text" name="Balancedue" onclick="document.form.balancedue.value=dateadd("d",-10,"document.form.eventdate.value")">
it doesnt work.
thanks
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
sweetyp is offline Offline
4 posts
since Oct 2005
Oct 31st, 2005
0

Re: dateadd function

You might want to ask this question in the JavaScript Forum.
Reputation Points: 11
Solved Threads: 8
Posting Whiz in Training
hooknc is offline Offline
216 posts
since Aug 2005
Nov 2nd, 2005
0

Re: dateadd function

You can cal the Date() function on onClick event and display the old date in the first field you should disable the first field .i think this is what u want ......just see the code below

<script type="text/javascript">
var mm = ['January','February','March','April','May','June','July','August','September','October','November','December']
function setday(obj){
this.y = obj.getFullYear();
this.m = obj.getMonth();
this.d = obj.getDate();
}
function ShowDate(){
var today = new Date();
var dd = new setday(today);
var h = today.getHours();
var tomor = new Date(dd.y,dd.m,dd.d-10);
var tt = new setday(tomor);
var theDay =(h>=14)?tt:dd;
var real=theDay.d+' '+mm[theDay.m]+' '+theDay.y;
document.menuform.name2.value=real;
alert(real)
}
</script>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shyamNambiar is offline Offline
9 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: hide link if variable is empty
Next Thread in JSP Forum Timeline: Advance search





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC