|
发表于 8-12-2012 11:40 PM
|
显示全部楼层
好像那个 http://flynXw.my 的Calendar Mode ??X
好像楼上讲的 (code 几鬼长2下 ):
http://code.jquery.com/ui/1.9.2/jquery-ui.js
这个比较短, 应该是该这个html:
http://calendarview.org/releases/1.2/javascripts/calendarview.js- //----------------------------------------------------------------------------
- // Create/Draw the Calendar HTML Elements
- //----------------------------------------------------------------------------
- create: function(parent)
- {
- // If no parent was specified, assume that we are creating a popup calendar.
- if (!parent) {
- parent = document.getElementsByTagName('body')[0]
- this.isPopup = true
- } else {
- this.isPopup = false
- }
- // Calendar Table
- var table = new Element('table')
- // Calendar Header
- var thead = new Element('thead')
- table.appendChild(thead)
- // Title Placeholder
- var row = new Element('tr')
- var cell = new Element('td', { colSpan: 7 } )
- cell.addClassName('title')
- row.appendChild(cell)
- thead.appendChild(row)
- // Calendar Navigation
- row = new Element('tr')
- this._drawButtonCell(row, '«', 1, Calendar.NAV_PREVIOUS_YEAR)
- this._drawButtonCell(row, '‹', 1, Calendar.NAV_PREVIOUS_MONTH)
- this._drawButtonCell(row, 'Today', 3, Calendar.NAV_TODAY)
- this._drawButtonCell(row, '›', 1, Calendar.NAV_NEXT_MONTH)
- this._drawButtonCell(row, '»', 1, Calendar.NAV_NEXT_YEAR)
- thead.appendChild(row)
- // Day Names
- row = new Element('tr')
- for (var i = 0; i < 7; ++i) {
- cell = new Element('th').update(Calendar.SHORT_DAY_NAMES[i])
- if (i == 0 || i == 6)
- cell.addClassName('weekend')
- row.appendChild(cell)
- }
- thead.appendChild(row)
- // Calendar Days
- var tbody = table.appendChild(new Element('tbody'))
- for (i = 6; i > 0; --i) {
- row = tbody.appendChild(new Element('tr'))
- row.addClassName('days')
- for (var j = 7; j > 0; --j) {
- cell = row.appendChild(new Element('td'))
- cell.calendar = this
- }
- }
- // Calendar Container (div)
- this.container = new Element('div')
- this.container.addClassName('calendar')
- if (this.isPopup) {
- this.container.setStyle({ position: 'absolute', display: 'none' })
- this.container.addClassName('popup')
- }
- this.container.appendChild(table)
- // Initialize Calendar
- this.update(this.date)
- // Observe the container for mousedown events
- Event.observe(this.container, 'mousedown', Calendar.handleMouseDownEvent)
- // Append to parent element
- parent.appendChild(this.container)
- },
- _drawButtonCell: function(parent, text, colSpan, navAction)
- {
- var cell = new Element('td')
- if (colSpan > 1) cell.colSpan = colSpan
- cell.className = 'button'
- cell.calendar = this
- cell.navAction = navAction
- cell.innerHTML = text
- cell.unselectable = 'on' // IE
- parent.appendChild(cell)
- return cell
- },
复制代码 |
|