Update calendar.js
parent
5e7ae920d2
commit
8c726b6071
|
@ -5,6 +5,7 @@
|
|||
position:absolute;
|
||||
width:250px;
|
||||
padding:0 5px;
|
||||
z-index:100;
|
||||
}
|
||||
.calendar-box select.calendar-month { width:90px; }
|
||||
.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.
|
||||
selectDate:function(year,month,day) {
|
||||
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]||'';
|
||||
if (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.
|
||||
showCalendar: function() {
|
||||
var input = document.getElementById(this.opt['input']);
|
||||
var input = this.opt['input'];
|
||||
|
||||
//Position the div in the correct location...
|
||||
var div = document.getElementById(this.opt['calendar']);
|
||||
|
@ -229,15 +229,19 @@ var Calendar = {
|
|||
},
|
||||
|
||||
/// Setup a text input box to be a calendar box.
|
||||
set: function(input_id) {
|
||||
var input = document.getElementById(input_id);
|
||||
if(!input) return; //If the input field is not there, exit.
|
||||
set: function(input_or_id)
|
||||
{
|
||||
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;
|
||||
addListener(input, 'focus', function(ev) {
|
||||
ths.opt['input'] = this.id;
|
||||
addListener(input_or_id, 'focus', function(ev) {
|
||||
ths.opt['input'] = this;
|
||||
ths.showCalendar();
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue