-
<html>
-
-
<head>
-
<title>Testing date function on 8 oct 2007</title>
-
<script language="Javascript" src="menu/calender/CalendarPopup.js"></script>
-
<script language="Javascript" src="menu/calender/AnchorPosition.js"></script>
-
<script language="Javascript" src="menu/calender/date.js"></script>
-
<script language="Javascript" src="menu/calender/PopupWindow.js"></script>
-
-
<script language="Javascript">
-
function calDate(downdate,podate,duration) {
-
//alert("You can"+downdate+"You can"+podate+"You can"+duration)
-
-
var myDate = new Date()
-
var result = myDate.setDate(myDate.getDate()+duration)
-
//var myDate = downdate
-
-
alert(result)
-
}
-
</script>
-
</head>
-
-
<body>
-
<form>
-
-
<script language="Javascript">
-
var cal1 = new CalendarPopup();
-
</script>
-
-
PO Receive Date: <input type="text" name="date2" value="" size=25>
-
<a href="#" onClick="cal1.select(document.forms[0].date2,'anchor2','dd-MMM-yyyy'); return false;" name="anchor2" id="anchor2">Select</a>
-
-
<br/>
-
-
Downpayment Date: <input type="text" name="date1" value="" size=25>
-
<a href="#" onClick="cal1.select(document.forms[0].date1,'anchor1','dd-MMM-yyyy'); return false;" name="anchor1" id="anchor1">Select</a>
-
-
<br/>
-
-
Estimate Duration: <select name="duration" onChange="calDate(document.forms[0].date1.value,document.forms[0].date2.value,document.forms[0].duration.value)">
-
<option value="">--
-
<option value="1">1
-
<option value="2">2
-
<option value="3">3
-
<option value="4">4
-
<option value="5">5
-
<option value="6">6
-
<option value="7">7
-
<option value="8">8
-
<option value="9">9
-
<option value="10">10
-
</select> Week(s)
-
-
<br/>
-
-
Estimate Completion Date: <input type="text" name="dateest" value="" size=25>
-
-
<br/>
-
-
Warranty Date: <input type="text" name="datewarranty" value="" size=25>
-
-
<br/>
-
-
Shipment Date: <input type="text" name="dateship" value="" size=25>
-
<a href="#" onClick="cal1.select(document.forms[0].dateship,'anchorship','dd-MMM-yyyy'); return false;" name="anchorship" id="anchorship">Select</a>
-
-
</form>
-
</body>
-
</html>
-
Hi,
Why my javascript produce funny output to me? Can someone guide me how to calculate the advance date based on the duration from the select box? And the output should pass value in the estimate date input box and not the alert msg box.I use alert msg box for testing purpose.
Thanks.
Can someone told me how to use the code tag in this forum?
10 1416
What's wrong happening with you ???
Debasis Jana
Hi,
I wan to calculate date in advance based on the user choice the date from the downpayment date and duration. I use the javascript to calculate and put the advance date in estimate completion date input box but the javascript cant work. It comes out result with a long integer. Can you guide me?
Thanks.
Hi,
I wan to calculate date in advance based on the user choice the date from the downpayment date and duration. I use the javascript to calculate and put the advance date in estimate completion date input box but the javascript cant work. It comes out result with a long integer. Can you guide me?
Thanks.
Oh ... I see.
You have the total milliseconds since 1970-1st-January.
Have a look at this.
It may help you.
Have a careful read on it :-)
Debasis Jana
-
function y2k(number) { return ( number<1000 ) ? number+1900:number; }
-
-
function add_days(adate,days){
-
return new Date (adate.getTime()=(days*86400000));
-
}
-
-
function format_date(adate){
-
return adate.getDate()+'/'+(adate.getMonth()+1)+'/'+y2k(adate.getYear());
-
}
-
-
function show_dates(adate){
-
var then = add_days(now,7);
-
var begin = format_date(now);
-
var end = format_date(then);
-
document.write(begin+'-'+end+'<br>');
-
}
-
-
var now = new Date(2007,10-1,27);
-
-
for (var i=0; i<2; i++){
-
show_dates(now);
-
now = add_days(now,7);
-
}
-
the above code will generate the output like this;
27/10/2007-3/11/2007
3/11/2007-10/11/2007
can someone guide me to edit this javascript to make it what i wan?
1) I would like to pass variable into javascript by the date that selected and duration by user. where should i to edit it?
2) I wan that user choice the duration (e.g 2 weeks) then pass to generate the date in advance by 2 weeks and call the function to calculate and i dun wan the function auto calculate to me when i haven pass the value in.
3) the output is 10/11/2007, the less of the output i no need and i would like to put this 10/11/2007 inside the estimate completion date.
Thanks in advance.
Have a change this function. -
function add_days(adate,days){
-
//return new Date (adate.getTime()=(days*86400000));
-
return adate.setDate(adate.getDate()+days);
-
}
-
Debasis Jana
Hi dmjpro,
the above change code will effect any thing? I try it but the result is nothing..
Hi dmjpro,
the above change code will effect any thing? I try it but the result is nothing..
Post here the total code you tried so far.
And tell me what's your expected Output and what you are getting now.
Debasis Jana
HI,
1)I wan pass in the duration from the select box to the for loop so i can calculate the date in advance based on the user select.
2)I wan pass in the date from downpayment date to the - var now = new Date (2007,10-1,27)
instead of default it.
3)I only wan this function calculate the date advance when i finish choice the duration in select box.
4)The output of this date in advance should print out in the "Estimate Completion Date".
Can u guide me the above four items.Thanks.
HI,
1)I wan pass in the duration from the select box to the for loop so i can calculate the date in advance based on the user select.
2)I wan pass in the date from downpayment date to the - var now = new Date (2007,10-1,27)
instead of default it.
3)I only wan this function calculate the date advance when i finish choice the duration in select box.
4)The output of this date in advance should print out in the "Estimate Completion Date".
Can u guide me the above four items.Thanks.
-
var now = new Date (2007,10-1,27);
-
This Code is not working?
Debasis Jana
Thanks..i already solved.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: NecroJoe |
last post by:
I am using PHP to generate a little javascript for one of my pages. In
short it allows a user to select a value from a list and pop it into a form
field on a seperate page. This works well unless...
|
by: Silvia Brunet-Jones |
last post by:
Ok I am about to pull my hair.
I have an active x control in an object tag which, as you
know cant have runat=server. So what I need is to not
loose what is in this box everytime a postback...
|
by: ged |
last post by:
Hi,
i am a oo (c#) programmer, and have not used javascript for a while and
i cant work out how javascript manages its references. Object
References work for simple stuff, but once i have an...
|
by: Nathan Sokalski |
last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls
using the Add method of the Attributes collection. However, if the
JavaScript code contains certain characters, such as & or...
|
by: TKapler |
last post by:
I think i am quite experienced javascript programmer, but I got a
problem.
I have a selectbox with e.g. 17 optgroups with 100 options.
I need a javascript code to hide some of that optgroups (i...
|
by: Mark Rae |
last post by:
Hi,
Just had an interesting message from someone who was unable to view one of
my sites because they have JavaScript turned off, and expecting me to
re-write my site so that they could view...
|
by: wkerplunk |
last post by:
Below is what I have build with several different languages. It works great but I need help, I am stuck.
When you click on an item in the dropdown autocomplete div it does a mousedown function...
|
by: kang jia |
last post by:
hi
now i am using javascript to do a "flexiable" validaion, what i mean "flexiable" is user can choose which one they would like fill in in the bank but at least they must enter one.
in my page,...
|
by: rassklass |
last post by:
HI all,
I have designed a site found at www.pickupnewspapers.co.uk/nottinghamshire/index.html but I cant get the footer to sit stil on the page. It is because of the javascript ticker, everytime...
|
by: happyse27 |
last post by:
Hi all,
I have enabled Javascripting in internet explorer 7, and I have been writing script in perl.
The thing I cant do now is to pop up image in small html frame from main html page.......
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |