Fixed #658 -- Fixed JavaScript calendar widget in IE. Thanks for the patch, kieranholland

git-svn-id: http://code.djangoproject.com/svn/django/trunk@977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-10-20 13:16:46 +00:00
parent a102942d7a
commit d8b8367494
2 changed files with 16 additions and 8 deletions

View File

@ -77,13 +77,15 @@ var DateTimeShortcuts = {
addEvent(clock_box, 'click', DateTimeShortcuts.cancelEventPropagation);
quickElement('h2', clock_box, 'Choose a time');
time_list = quickElement('ul', clock_box, '', 'class', 'timelist');
time_list = quickElement('ul', clock_box, '');
time_list.className = 'timelist';
quickElement("a", quickElement("li", time_list, ""), "Now", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinute());")
quickElement("a", quickElement("li", time_list, ""), "Midnight", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '00:00');")
quickElement("a", quickElement("li", time_list, ""), "6 a.m.", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '06:00');")
quickElement("a", quickElement("li", time_list, ""), "Noon", "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '12:00');")
cancel_p = quickElement('p', clock_box, '', 'class', 'calendar-cancel');
cancel_p = quickElement('p', clock_box, '');
cancel_p.className = 'calendar-cancel';
quickElement('a', cancel_p, 'Cancel', 'href', 'javascript:DateTimeShortcuts.dismissClock(' + num + ');');
},
openClock: function(num) {
@ -147,8 +149,10 @@ var DateTimeShortcuts = {
// next-prev links
var cal_nav = quickElement('div', cal_box, '');
quickElement('a', cal_nav, '<', 'class', 'calendarnav-previous', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');');
quickElement('a', cal_nav, '>', 'class', 'calendarnav-next', 'href', 'javascript:DateTimeShortcuts.drawNext('+num+');');
var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');');
cal_nav_prev.className = 'calendarnav-previous';
var cal_nav_next = quickElement('a', cal_nav, '>', 'href', 'javascript:DateTimeShortcuts.drawNext('+num+');');
cal_nav_next.className = 'calendarnav-next';
cal_box.appendChild(cal_nav);
// main box
@ -158,7 +162,8 @@ var DateTimeShortcuts = {
DateTimeShortcuts.calendars[num].drawCurrent();
// calendar shortcuts
var shortcuts = quickElement('div', cal_box, '', 'class', 'calendar-shortcuts');
var shortcuts = quickElement('div', cal_box, '');
shortcuts.className = 'calendar-shortcuts';
quickElement('a', shortcuts, 'Yesterday', 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', -1);');
shortcuts.appendChild(document.createTextNode('\240|\240'));
quickElement('a', shortcuts, 'Today', 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', 0);');
@ -166,7 +171,8 @@ var DateTimeShortcuts = {
quickElement('a', shortcuts, 'Tomorrow', 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', +1);');
// cancel bar
var cancel_p = quickElement('p', cal_box, '', 'class', 'calendar-cancel');
var cancel_p = quickElement('p', cal_box, '');
cancel_p.className = 'calendar-cancel';
quickElement('a', cancel_p, 'Cancel', 'href', 'javascript:DateTimeShortcuts.dismissCalendar(' + num + ');');
},
openCalendar: function(num) {

View File

@ -65,7 +65,8 @@ var CalendarNamespace = {
// Draw blanks before first of month
tableRow = quickElement('tr', tableBody);
for (var i = 0; i < startingPos; i++) {
quickElement('td', tableRow, ' ', 'bgcolor','#f3f3f3');
var _cell = quickElement('td', tableRow, ' ');
_cell.style.backgroundColor = '#f3f3f3';
}
// Draw days of month
@ -81,7 +82,8 @@ var CalendarNamespace = {
// Draw blanks after end of month (optional, but makes for valid code)
while (tableRow.childNodes.length < 7) {
quickElement('td', tableRow, ' ', 'bgcolor','#f3f3f3');
var _cell = quickElement('td', tableRow, ' ');
_cell.style.backgroundColor = '#f3f3f3';
}
calDiv.appendChild(calTable);