Update calendar.js
parent
5e7ae920d2
commit
8c726b6071
|
@ -5,6 +5,7 @@
|
||||||
position:absolute;
|
position:absolute;
|
||||||
width:250px;
|
width:250px;
|
||||||
padding:0 5px;
|
padding:0 5px;
|
||||||
|
z-index:100;
|
||||||
}
|
}
|
||||||
.calendar-box select.calendar-month { width:90px; }
|
.calendar-box select.calendar-month { width:90px; }
|
||||||
.calendar-box select.calendar-year { width:70px; }
|
.calendar-box select.calendar-year { width:70px; }
|
||||||
|
|
20
calendar.js
20
calendar.js
|
@ -34,7 +34,7 @@ var Calendar = {
|
||||||
/// Called when the user clicks on a date in the calendar.
|
/// Called when the user clicks on a date in the calendar.
|
||||||
selectDate:function(year,month,day) {
|
selectDate:function(year,month,day) {
|
||||||
var ths = _calendar_active_instance;
|
var ths = _calendar_active_instance;
|
||||||
var i = document.getElementById(ths.opt["input"]);
|
var i = ths.opt["input"];
|
||||||
var t = i.value.split(/\s+/, 2)[1]||'';
|
var t = i.value.split(/\s+/, 2)[1]||'';
|
||||||
if (t)
|
if (t)
|
||||||
t = ' '+t;
|
t = ' '+t;
|
||||||
|
@ -163,7 +163,7 @@ var Calendar = {
|
||||||
|
|
||||||
/// Display the calendar - if a date exists in the input box, that will be selected in the calendar.
|
/// Display the calendar - if a date exists in the input box, that will be selected in the calendar.
|
||||||
showCalendar: function() {
|
showCalendar: function() {
|
||||||
var input = document.getElementById(this.opt['input']);
|
var input = this.opt['input'];
|
||||||
|
|
||||||
//Position the div in the correct location...
|
//Position the div in the correct location...
|
||||||
var div = document.getElementById(this.opt['calendar']);
|
var div = document.getElementById(this.opt['calendar']);
|
||||||
|
@ -229,15 +229,19 @@ var Calendar = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Setup a text input box to be a calendar box.
|
/// Setup a text input box to be a calendar box.
|
||||||
set: function(input_id) {
|
set: function(input_or_id)
|
||||||
var input = document.getElementById(input_id);
|
{
|
||||||
if(!input) return; //If the input field is not there, exit.
|
if (typeof input_or_id == 'string')
|
||||||
|
input_or_id = document.getElementById(input_or_id);
|
||||||
|
if (!input_or_id)
|
||||||
|
return; // If the input field is not there, exit.
|
||||||
|
|
||||||
if(!this.opt['calendar']) this.init();
|
if (!this.opt['calendar'])
|
||||||
|
this.init();
|
||||||
|
|
||||||
var ths = this;
|
var ths = this;
|
||||||
addListener(input, 'focus', function(ev) {
|
addListener(input_or_id, 'focus', function(ev) {
|
||||||
ths.opt['input'] = this.id;
|
ths.opt['input'] = this;
|
||||||
ths.showCalendar();
|
ths.showCalendar();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue