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

Friday 17th of November 2017 10:24:44 PM
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
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!

This all seems familiar enough, even when the boldfaced textstretches across multiple lines. Turn to Figure 7-61to see what happens with padding set on an inline element displayedacross multiple lines:

B {padding: 10px; background: silver;}
Figure 7-61

Figure 7-61. Padding on an inline element that spans multiple lines

As with margins, the left padding is applied to the beginning of theelement, and the right padding to the end of it; padding is computed value. This factor is applied to the element and all of its child elements, so that each element has a line-height calculated with respect to its own font-size, as demonstrated in Figure 4-25:

BODY {font-size: 10pt;}
DIV {line-height: 1.5;}
P {font-size: 18pt;}
<DIV>
<P>This paragraph's 'font-size' is 18pt, and since the 'line-height'usually first attempt to support. Given that there were some verygood positioning implementations on the horizon as the book was beingcompleted, we felt it worthwhile to give readers a glimpse ofwhat's coming soon -- or, if you're reading this booka year or three after its publication, what can be done.

You may notice that, unlike other chapters, almost none of thefigures in this chapter was generated with a web browser. This issomething of a statement about the reliability and consistency ofpositioning implementations at the time of this writing: not one ofbecause it makes things easier to read.

It is extremely important to note that the values forrect(...) are notside-offsets. They are, instead, distances from theupper-left corner of the element. Thus, a clipping rectangle whichencloses a square 20 pixels by 20 pixels in the upper-left corner ofthe element would be defined as:

rect(0, 20px, 20px, 0)
remain are the details of what happens when absolute positioning isinvoked.

When an element is positioned absolutely, it is completely removedfrom the document flow. It is then positioned with respect to itscontaining block, and its edges are placed using the side-offsetproperties. The positioned element does not flow around the contentof other elements, nor does their content flow around the positionedelement. This implies that an absolutely positioned element mayoverlap other elements, or be overlapped by them. (We'll see