ATimePicker - A java time picker applet

ATimePicker allows your user to
  • Pickup an hour and update a field
  • Pickup a delay and update on or more field
The hour format is fully parametrable. The applet can update a field in the page or call an URL with the hour in parameter. Look at example 3 to see the hours using the am/pm format.
Example 1 : Pick up an hour
Example 2 : Pick up a delay and update 3 fields
Example 3 : Pick up a delay and update 1 field, am/pm format
Example 4 : Calling a javascript function
Download timepick.zip

Pick up an hour

Selected hour :

HTML code

<APPLET CODE="ATimePicker.class" ARCHIVE="ATimePicker.jar" 
WIDTH=100 HEIGHT=260 MAYSCRIPT>
<PARAM name="form" VALUE="tform">
<PARAM name="field1" VALUE="tfield">
<PARAM name="format1" VALUE="H:M">
<PARAM name="selint" VALUE="10">

Pick up a delay and update 3 fields

First hour :
Last hour :
Delay :

HTML code

<APPLET CODE="ATimePicker.class" ARCHIVE="ATimePicker.jar" 
WIDTH=100 HEIGHT=240 MAYSCRIPT>
<PARAM NAME="form" VALUE="tform1">
<PARAM NAME="multi" VALUE="o">
<PARAM NAME="field1" VALUE="tfield11">
<PARAM NAME="format1" VALUE="H:M">
<PARAM NAME="field2" VALUE="tfield12">
<PARAM NAME="format2" VALUE="h:m">
<PARAM NAME="field3" VALUE="tfield13">
<PARAM NAME="format3" VALUE="D:d">

Pick up a delay and update 1 field

Result :

HTML code

<APPLET CODE="ATimePicker.class" ARCHIVE="ATimePicker.jar" 
WIDTH=100 HEIGHT=240 MAYSCRIPT>
<PARAM NAME="form" VALUE="tform2">
<PARAM NAME="multi" VALUE="o">
<PARAM NAME="field1" VALUE="tfield">
<PARAM NAME="format1" VALUE="H:MP - h:mp ( D:d )">
<PARAM NAME="h1" VALUE="9">
<PARAM NAME="hmin" VALUE="8">
<PARAM NAME="hmax" VALUE="20">
<PARAM NAME="ampm" VALUE="y">
<PARAM name="bgcolor" VALUE="ffce63">

Calling a javascript function

HTML code

<SCRIPT LANGUAGE="JavaScript">
<!--
function alertTime()
<
alert("Hour = "+document.timepicker.stringFormat('H')+
   ", minute="+document.timepicker.stringFormat('M'));
}
//-->
</SCRIPT>

<APPLET CODE="ATimePicker.class" ARCHIVE="ATimePicker.jar" name=timepicker" WIDTH=100 HEIGHT=200 MAYSCRIPT> <PARAM name="nowatch" VALUE=""> <PARAM name="selint" VALUE="10"> <PARAM name="h1" VALUE="9"> <PARAM name="hmin" VALUE="8"> <PARAM name="hmax" VALUE="20"> <PARAM name="ampm" VALUE="y"> <PARAM name="bgcolor" VALUE="ffce63"> <param name="jvf" value="alertTime()"> </APPLET>

ATimePicker parameters

multiWhen this parameter is present, ATimePicker allows to pickup a delay, when it is absent, ATimePicker allows to pick up a hour.
ampmWhen this parameter is present, the hours are displayed from 0:00am to 11:00pm instead of 0:00 to 24:00
formForm name
field1..field9Field to update. Up to 9 fields
format1..format9Field to update format. Each field mut ABSOLUTELY have a format. The format is a string. Theses characters are translated :
HBegin hour
MMinutes of the begin hour
PPeriod ( am or PM ) of the begin hour
hEnd hour
mMinutes of the end hour
pPeriod ( am or PM ) of the end hour
DNumber of hour in the delay
dNumber of minutes in the delay
The other characters are displayed as is.
nowatchWhen this parameter is present, the little watch doesn't appear.
URLWhen this parameter is present, the parameter field1 must contain an URL. This URL is called with the hour in parameter, the format of the hour is given by format1
For exemple
<PARAM name="field1" VALUE="http://www.myserver.com/myasp">
<PARAM name="format1" VALUE="H:M">
If the user click on 8h30, the url http://www.myserver.com/myasp?8:30 is called.
selintBy default, the user can choose time from 15 minutes to 15 minutes. This parameter allows to change the interval in minutes that the user can select.
hminMinimum hour the picker can display. Default is 0
hmaxMaximum hour the picker can display. Default is 24
h1First hour initialy displayed by the picker. Must be greater or equal to hmin. Default is 8
h2Last hour initialy displayed by the picker. Must be less or equal to hmax.
bgcolorBackground color using RGB format.
jvfName of the javascript function to call. Don't forget the (). See example 4
The applet has a usefull method stringFormat to peek the time picker values
This function wait for a string as parameter. This string has the same format has the parameters format1 to format9
Example
  • document.timepicker.stringFormat('H') return the first hour selected
  • document.timepicker.stringFormat('M') return the minutes first hour selected
  • document.timepicker.stringFormat('H:M-h:m') return a string like 01:30-03:00