File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Help needed in javascript coding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help needed in javascript coding" Watch "Help needed in javascript coding" New topic

Help needed in javascript coding

Sree Mami
Ranch Hand

Joined: Jul 13, 2006
Posts: 75
Hi all

I am again here with a big task in my project which I am unable to do.

I am having 3 text fields and 3 list boxes;

Two text fields will contain values of two different dates (which I am getting using the datetimepicker.js library file) one for start date and another for end date.

Two list boxes which have time duration of 24hours with an interval of 5 minutes each as its options.. One list box for start time and another for end time.

3rd list box which has its options as: minutes, hours, days, months and years.

I have 3rd text field, "time allotted" which takes a numeric value as its input.

Now the problem is when I select dates from the first two text fields: start date and end date, I have to calculate the difference of the dates and display the difference in the "time allotted" text box and make "days" selected from the list box. Similarly if I select same date from the first two text fields and select time from the list boxes: start time and end time, I need to calculate difference of the both the times and display the difference in the "time allotted" text box and make "minutes" selected. And same is the case with months and years. Can anyone help me how to achieve this task.

I wrote a loop to generate values in the start time and end time list boxes:

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
var Date1 = new Date(datefiled + timeFiled);

I agree. Here's the link:
subject: Help needed in javascript coding
It's not a secret anymore!