dateadd function

Reply

Join Date: Oct 2005
Posts: 4
Reputation: sweetyp is an unknown quantity at this point 
Solved Threads: 0
sweetyp sweetyp is offline Offline
Newbie Poster

dateadd function

 
0
  #1
Oct 27th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 216
Reputation: hooknc is an unknown quantity at this point 
Solved Threads: 8
hooknc hooknc is offline Offline
Posting Whiz in Training

Re: dateadd function

 
0
  #2
Oct 31st, 2005
You might want to ask this question in the JavaScript Forum.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 9
Reputation: shyamNambiar is an unknown quantity at this point 
Solved Threads: 0
shyamNambiar's Avatar
shyamNambiar shyamNambiar is offline Offline
Newbie Poster

Re: dateadd function

 
0
  #3
Nov 2nd, 2005
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>
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JSP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC