Jason Moon's Fool-Proof Date Input Script (with calendar)

Monday 22nd of January 2018 06:50:39 AM
Contact Jason Visit Jason's Site

Called with the "DateInput" function. Parameters are:

  1. DateName - STRING - name of the hidden form element to store the selected, formatted date
  2. Required - BOOLEAN - optional; default = FALSE
  3. DateFormat - STRING - optional
  4. DefaultDate - STRING - optional; default = current system date from the client PC
vertical-align values will have different effects. All of the elements could be top-aligned, for example. We'll return to vertical alignment later in the chapter, but for now will assume that everything is baseline-aligned.

Now the line-height comes into play. Let's assume the following case:

<P STYLE="font-size: 12px; line-height: 12px;">
This is text, <EM>some of which is emphasized</EM>, plus other text<BR>
Birthday:
 
* required
Called like this: DateInput('birth_date', true, 'DD-MON-YYYY', '01-AUG-1976')
 
 
Anniversary:
 
Called like this: DateInput('anniversary', false, 'DD-MON-YYYY', '28-JUN-2003')
 
 
Some Date:
 
Called like this: DateInput('some_date', false, 'DD-MON-YY')
 
 
Today:
 
Called like this: DateInput('today', true)
 

Supported date formats:

* Can specify a 2-digit year


Customizable variables:


View the JavaScript source! type2, as shown in Figure 6-8:

IMG.type1 {color: gray; border-style: solid;}IMG.type2 {border-color: gray; border-style: solid;}
Figure 6-8

Figure 6-8. Setting the border color for images

Border colors, and borders in general, are all discussed in muchgreater detail in the Chapter 7, "Boxes and Borders".