PageSourceSearch

https://www.gddinstruments.com/components/com_proforms/js/calendar/m4j.js

js gddinstruments.com collected 2026-10-04 13:23:44 UTC 2,526 bytes, 63 lines download raw bytes

1// JS Calendar
2var calendar = null; // remember the calendar object so that we reuse
3// it and avoid creating another
4
5// This function gets called when an end-user clicks on some date
6function selected(cal, date) {
7	
8	cal.sel.value = date; // just update the value of the input field
9	if(cal.sel.alt == "1000"){
10		validateField(cal.sel);
11	}
12}
13
14// And this gets called when the end-user clicks on the _selected_ date,
15// or clicks the "Close" (X) button.  It just hides the calendar without
16// destroying it.
17function closeHandler(cal) {
18	cal.hide();			// hide the calendar
19
20	// don't check mousedown on document anymore (used to be able to hide the
21	// calendar when someone clicks outside it, see the showCalendar function).
22	Calendar.removeEvent(document, "mousedown", checkCalendar);
23}
24
25// This gets called when the user presses a mouse button anywhere in the
26// document, if the calendar is shown.  If the click was outside the open
27// calendar this function closes it.
28function checkCalendar(ev) {
29	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
30	for (; el != null; el = el.parentNode)
31	// FIXME: allow end-user to click some link without closing the
32	// calendar.  Good to see real-time stylesheet change :)
33	if (el == calendar.element || el.tagName == "A") break;
34	if (el == null) {
35		// calls closeHandler which should hide the calendar.
36		calendar.callCloseHandler(); Calendar.stopEvent(ev);
37	}
38}
39
40// This function shows the calendar under the element having the given id.
41// It takes care of catching "mousedown" signals on document and hiding the
42// calendar if the click was outside.
43function showCalendar(id) {
44	var el = document.getElementById(id);
45	if (calendar != null) {
46		// we already have one created, so just update it.
47		calendar.hide();		// hide the existing calendar
48		calendar.parseDate(el.value); // set it to a new date
49	} else {
50		// first-time call, create the calendar
51		var cal = new Calendar(true, null, selected, closeHandler);
52		calendar = cal;		// remember the calendar in the global
53		cal.setRange(1900, 2070);	// min/max year allowed
54		calendar.create();		// create a popup calendar
55		calendar.parseDate(el.value); // set it to a new date
56	}
57	calendar.sel = el;		// inform it about the input field in use
58	calendar.showAtElement(el);	// show the calendar next to the input field
59
60	// catch mousedown on the document
61	Calendar.addEvent(document, "mousedown", checkCalendar);
62	return false;
63}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.