⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clock.htc

📁 财务预算管理 财务支出
💻 HTC
📖 第 1 页 / 共 3 页
字号:

<script language="javascript">

//------------------------------------------------------------------------
// Attach to element events
//------------------------------------------------------------------------

element.attachEvent("onselectstart", fnOnSelectStart)
element.attachEvent("onclick", fnOnClick)
element.attachEvent("onpropertychange", fnOnPropertyChange)
element.attachEvent("onreadystatechange", fnOnReadyStateChange)


var StyleInfo            = null            // Style sheet with rules for this calendar
var goStyle              = new Object()    // A hash of style sheet rules that apply to this calendar
var gaMinuteCell            = new Array()     // an array of the table cells for minutes
var goHourSelect        = null            // The hour select control
var goCurrentMinuteCell     = null            // The cell for the currently selected minute
var gbLoading            = true            // Flag for if the behavior is loading

var giMinute                                  // minute of the hour (1 to 60)
var giHour                                // hour of the year (1 to 24)

var giHourLength        = 1               // hour length (0,1)
var giMinuteLength          = 1               // minute length (0 to 2)
var gsGridCellEffect     = 'raised'        // Grid cell effect
var gsGridLinesColor     = 'black'         // Grid line color
var gbShowTimeSelectors  = true            // Show time selectors (0,1)
//var gbShowMinutes           = true            // Show the minutes of the week titles (0,1)
var gbShowTitle          = true            // Show the title (0,1)
var gbShowHorizontalGrid = true            // Show the horizontal grid (0,1)
var gbShowVerticalGrid   = true            // Show the vertical grid (0,1)
var gbValueIsNull        = false           // There is no value selected (0,1)
var gbReadOnly           = false           // The user can not interact with the control


// Load the property values defined on the element to replace defaults
fnGetPropertyDefaults()

// Create the style sheets needed for the calendar display
fnCreateStyleSheets()

// Insert the HTML elements needed for the calendar display
fnCreateCalendarHTML()

// Build the hour select control
fnBuildHourSelect()

// Fill in the cells with the minutes of the hour and set style values
fnFillInCells()

// **********************************************************************
//                       PROPERTY GET/SET FUNCTIONS
// **********************************************************************

function fnGetMinute()
{
  return (gbValueIsNull) ? null : giMinute
}

function fnPutMinute(iMinute)
{
  if (gbLoading) return  // return if the behavior is loading
  
  iMinute = parseInt(iMinute)
  if (isNaN(iMinute)) throw 450

  fnSetTime(iMinute, giHour)
}
//--------------------------------------------------------------------------
function fnGetHour()
{
  return (gbValueIsNull) ? null : giHour
}

function fnPutHour(iHour)
{
  if (gbLoading) return  // return if the behavior is loading

  iHour = parseInt(iHour)
  if (isNaN(iHour)) throw 450

  fnSetTime(giMinute, iHour)
}

//------------------------------------------------------------------------

function fnGetHourLength()
{
  if (giHourLength == 0) return "short"
  if (giHourLength == 1) return "long"
}

function fnPutHourLength(sLength)
{
  if (gbLoading) return  // return if the behavior is loading

  switch (sLength.toLowerCase())
  {
    case "short" :
      if (giHourLength == 0) return
      giHourLength = 0
      break;
    case "long" : 
      if (giHourLength == 1) return
      giHourLength = 1
      break;
    default :
      throw 450
      return
  }

  fnBuildHourSelect()
}

//------------------------------------------------------------------------

function fnGetMinuteLength()
{
  if (giMinuteLength == 0) return "short"
  if (giMinuteLength == 1) return "medium"
  if (giMinuteLength == 2) return "long"
}

function fnPutMinuteLength(sLength)
{
  if (gbLoading) return  // return if the behavior is loading

  switch (sLength.toLowerCase())
  {
    case "short" :
      if (giMinuteLength == 0) return
      giMinuteLength = 0
      break;
    case "medium" : 
      if (giMinuteLength == 1) return
      giMinuteLength = 1
      break;
    case "long" : 
      if (giMinuteLength == 2) return
      giMinuteLength = 2
      break;
    default :
      throw 450
      return
  }

  // Used to force a table resize if needed
  goStyle['MinuteSelected'].borderStyle = 'solid'  
}

//------------------------------------------------------------------------

function fnGetGridCellEffect()
{
  return gsGridCellEffect
}

function fnPutGridCellEffect(sEffect)
{
  if (gbLoading) return  // return if the behavior is loading

  switch (sEffect.toLowerCase())
  {
    case "raised" :
      if (gsGridCellEffect == 'raised') return
      gsGridCellEffect = 'raised'
      fnUptimeGridColors()
      break
    case "flat" : 
      if (gsGridCellEffect == 'flat') return
      gsGridCellEffect = 'flat'
      fnUptimeGridColors()
      break
    case "sunken" : 
      if (gsGridCellEffect == 'sunken') return
      gsGridCellEffect = 'sunken'
      fnUptimeGridColors()
      break
    default :
      throw 450
  }
}

//------------------------------------------------------------------------

function fnGetGridLinesColor()
{
  return gsGridLinesColor
}

function fnPutGridLinesColor(sGridLinesColor)
{
  if (gbLoading) return  // return if the behavior is loading

  gsGridLinesColor = sGridLinesColor
  fnUptimeGridColors()
}

//------------------------------------------------------------------------

function fnGetShowVerticalGrid()
{
  return gbShowVerticalGrid
}

function fnPutShowVerticalGrid(bShowVerticalGrid)
{
  if (gbLoading) return  // return if the behavior is loading

  if ((bShowVerticalGrid) != gbShowVerticalGrid)
  {
    gbShowVerticalGrid = (bShowVerticalGrid) ? true : false
    fnFireOnPropertyChange("propertyName", "showVerticalGrid")
    fnUptimeGridColors()
  }
}

//------------------------------------------------------------------------

function fnGetShowHorizontalGrid()
{
  return gbShowHorizontalGrid
}

function fnPutShowHorizontalGrid(bShowHorizontalGrid)
{
  if (gbLoading) return  // return if the behavior is loading

  if ((bShowHorizontalGrid) != gbShowHorizontalGrid)
  {
    gbShowHorizontalGrid = (bShowHorizontalGrid) ? true : false
    fnFireOnPropertyChange("propertyName", "showHorizontalGrid")
    fnUptimeGridColors()
  }
}

//------------------------------------------------------------------------

function fnGetShowTimeSelectors()
{
  return gbShowTimeSelectors
}

function fnPutShowTimeSelectors(bShowTimeSelectors)
{
  if (gbLoading) return  // return if the behavior is loading

  gbShowTimeSelectors = (bShowTimeSelectors) ? true : false
  element.children[0].rows[0].cells[1].style.display = (gbShowTimeSelectors) ? '' : 'none'

  element.children[0].rows[0].style.display = (gbShowTimeSelectors || gbShowTitle) ? '' : 'none'
}


//------------------------------------------------------------------------

function fnGetShowMinutes()
{
  return gbShowMinutes
}

function fnPutShowMinutes(bShowMinutes)
{
  if (gbLoading) return  // return if the behavior is loading

  gbShowMinutes = (bShowMinutes) ? true : false
  goMinuteTitleRow.style.display = (gbShowMinutes) ? '' : 'none'
}

//------------------------------------------------------------------------

function fnGetValue()
{
  var sValue

  if (gbValueIsNull) return null
  sValue = ((giMinute < 10) ? '0' + giMinute : giMinute) + '/' +
           ((giHour < 10) ? '0' + giHour : giHour) 
  return sValue 
}

function fnPutValue(sValue)
{
  if (gbLoading) return  // return if the behavior is loading

  var aValue = sValue.split('/')

  // ensure valid valuse for hour, minute, and year
  aValue[0]++ ; aValue[0]-- ; aValue[1]++ ; aValue[1]-- ; 
  if ( isNaN(aValue[0]) || isNaN(aValue[1]) ) throw 450

  fnSetTime(aValue[0], aValue[1])
}

//------------------------------------------------------------------------

function fnGetValueIsNull() 
{ 
  return gbValueIsNull 
}

function fnPutValueIsNull(bValueIsNull)
{
  if (gbLoading) return  // return if the behavior is loading

  if ((bValueIsNull) != gbValueIsNull)
  {
    gbValueIsNull = (bValueIsNull) ? true : false
    fnFireOnPropertyChange("propertyName", "readOnly")
  }

  goCurrentMinuteCell.className = (bValueIsNull) ? 
    'Minute_' + uniqueID : 'MinuteSelected_' + uniqueID
}

//------------------------------------------------------------------------

function fnGetReadOnly()
{
  return (gbReadOnly) ? true : false
}

function fnPutReadOnly(bReadOnly)
{
  if (gbLoading) return  // return if the behavior is loading

  if ((bReadOnly) != gbReadOnly)
  {
    gbReadOnly = (bReadOnly) ? true : false
    fnFireOnPropertyChange("propertyName", "readOnly")
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -