0

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

3
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by shyamNambiar
0

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 =
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>

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.