|
Hi to all
i am new to this forum . i want code for one particular issue that is related to date . think that we have two text fields
in one text field we selecting the date. this is using for
selecting a book from library .here user is selecting a book for
that user mentioning the selected date based on that date .
automatically in second field that is returning date field has to
field with after two weeks date . that means based on the user
selected date automatically returning date has to displayed in
returning date field where if user select a selecting date as
11-april-2008 then returning date automatically displayed in
return date test field as 24-april-2008 . this type of
calucations has to done in java script and displayed in
returning date text field. if any one know about this problem or
any one have code for this please reply me . it is urgent for me .plz give me reply .
|
|
|
<script type="text/javascript">
var date = new Date();
var month = date.getMonth()+1;
var today = date.getDate();
var returnDay = date.getDate()+14;
var returnMonth = month;
if(returnDay>31)
{
returnDay -=31;
var returnMonth = month+=1;
}
var todayIs = today + ":" + month;
var returnBy = returnDay + ":" + returnMonth;
document.getElementById('issuedate').setAttribute('value',todayIs);
document.getElementById('returndate').setAttribute('value',returnBy);
</script>
<input type="text" id="issuedate" />
<input type="text" id="returndate" />
The above code should return both dates ... Todays date, what ever it may be .. And a date 2 weeks from now.
|
|
|
|
|
|
|
// |