Slide tab : Tab « GUI Components « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Event
7. Event onMethod
8. Form Control
9. GUI Components
10. HTML
11. Javascript Collections
12. Javascript Objects
13. Language Basics
14. Node Operation
15. Object Oriented
16. Page Components
17. Security
18. Style Layout
19. Table
20. Utilities
21. Window Browser
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
JavaScript DHTML » GUI Components » Tab 
Slide tab

<html><head><title>DHTML Calendar</title>

<meta name="author" content="Eric Pretorious">
<meta name="subject" content="DHTML Calendar">
<meta name="keywords" content="DHTML, dynamic HTML, crossbrowser, cross-browser, cross browser, javascript, calendar script">

<!-- style.css -->
<style rel="stylesheet" type="text/css">
#banner {
  position:absolute;
  top:0px;left:0px;
  width:740px;height:110px;
  padding:10px;margin:10px;
  border-bottom:1px solid gray;
}
#buttons {
  position:absolute;
  z-index:0;
  top:141px;left:10px;
}
.button {
  position:relative;
  width:140px;
  background:#ccffcc;
  border:1px solid #99ff99;
  padding:9px;margin:10px;
  font-family:sans-serif;font-size:10px;
}
.badge {
  position:relative;
  width:140px;
  background:transparent;
  padding:10px;margin:10px;
  text-align:center;
}
.badge a img {
  border:1px solid white;
}
#cover {
  position:absolute;
  z-index:2;
  top:141px;left:191px;
  width:570px;height:450px;
  background:#ccccff;
  border:1px solid #ff9999;
  padding:0;margin:10 8 10 0;
  font-family:sans-serif;font-size:10px;
}
#page {
  position:absolute;
  z-index:1;
  top:141px;left:191px;
  width:570px;height:450px;
  background:#ccccff;
  border:1px solid #9999ff;
  padding:0;margin:10 8 10 0;
  font-family:sans-serif;font-size:10px;
}
.container {
  position:absolute;
  width:550px;
  background:transparent;
  border-bottom:1px solid gray;
  padding-bottom:10px;margin:10px;
}
.container .title {
  font-weight:600;
  font-size:11px;
  padding:0;margin:0;
}
.container .content {
  font-weight:400;
  font-size:10px;
  line-height:18px;
}
.code_ref {
  position:relative;
  display:block;
  border:1px solid #9999ff;
  background:white;
  padding:10px;
  margin:5 0 5 0;
}

</style>
<!-- DHTML_Calendar.css -->
<style rel="stylesheet" type="text/css">
#DHTMLC {
  position:relative;
  margin:0 0 10 10;
  height:180px;width:230px;
  visibility:hidden;
  font-family:verdana, arial, sans-serif;font-size:10px;
  line-height:18px;
  background-color:white;border:1px solid #9999ff;
}

.months {
  position:absolute;
  height :18px;width:45px;
  text-align:center;background-color:#ccccff;
}

.dotw {
  position:absolute;
  height :18px;width:28px;
  text-align:center;background-color:#ccccff;
}

.days {
  position:absolute;
  height :18px;width:28px;
  text-align:center;background-color:white;
}

.days a:link {
  text-decoration:none;
}

#moniker {
  height:18px;width:210px;
  text-align:center;color:#ccc;
  font-family:verdana, arial, sans-serif;font-size:7px;
  line-height:9px;
}

#moniker a:link {
  color:gray;
}

</style>
<!-- cbe_core.js -->
<script type="text/javascript" >
/* cbe_core.js $Revision: 0.22 $
 * CBE v4.19, Cross-Browser DHTML API from Cross-Browser.com
 * Copyright (c) 2002 Michael Foster (mike@cross-browser.com)
 * Distributed under the terms of the GNU LGPL from gnu.org
*/
var cbeVersion="4.19", cbeDocumentId='idDocument', cbeWindowId='idWindow', cbeAll=new Array();
window.onload=function(){cbeInitialize("DIV""SPAN")if (window.windowOnloadwindow.windowOnload();}
window.onunload=function(){if(window.windowOnunload){window.windowOnunload();}if(window.cbeDebugObj){window.cbeDebugObj=null;}for(var i=0; i<cbeAll.length; i++){if(cbeAll[i]){if(cbeAll[i].ele){if(cbeAll[i].ele.cbe){cbeAll[i].ele.cbe=null;}cbeAll[i].ele=null;}cbeAll[i]=null;}}}
function CrossBrowserNode(){this.parentNode=nullthis.childNodes=0this.firstChild=nullthis.lastChild=nullthis.previousSibling=nullthis.nextSibling=null;}
CrossBrowserNode.prototype.appendNode=function(cbeChild){if (cbeChild){if (!this.firstChild){this.firstChild=cbeChild;else{cbeChild.previousSibling=this.lastChild; this.lastChild.nextSibling=cbeChild;}cbeChild.parentNode=thisthis.lastChild=cbeChild; ++this.childNodes;}return cbeChild;}
CrossBrowserElement.prototype=new CrossBrowserNode;
function CrossBrowserElement(){
  this.contains=this.left=this.top=this.offsetLeft=this.offsetTop=this.pageX=this.pageY=this.zIndex=_retZero;
  this.show=this.hide=this.moveTo=this.moveBy=this.sizeTo=this.sizeBy=this.resizeTo=this.resizeBy=_retVoid;
  this.visibility=this.color=this.background=this.clip=this.innerHtml=_retEStr;
  if (cbeAll.length < 2){this.width=cbeInnerWidth; this.height=cbeInnerHeight; this.scrollLeft=cbePageXOffset; this.scrollTop=cbePageYOffset;}
  else{this.width=this.height=this.scrollLeft=this.scrollTop=_retZero;}
  this.id=""this.index=cbeAll.length; cbeAll[this.index]=thisthis.w=this.h=0this.x=this.y=0;
  if (window.cbeEventJsLoadedthis.listeners=new Array();
}
function cbeBindElement(cbe, ele){
  if (!cbe || !elereturn;
  cbe.ele=ele; cbe.ele.cbe=cbe; cbe.parentElement=cbeGetParentElement(ele);
  if (ele==window){cbe.id=ele.id=cbeWindowId; return;else if (ele==document){cbe.id=ele.id=cbeDocumentId; return;else{cbe.id=ele.id;}
  if (_def(ele.clip)){cbe.w=ele.clip.width; cbe.h=ele.clip.height;}
  var css=_def(ele.style);
  // left, top
  cbe.moveTo=_cbeMoveTo; cbe.moveBy=_cbeMoveBy; if (css && _def(ele.style.left, ele.style.top&& typeof(ele.style.left)=="string"){cbe.left=_domLeft; cbe.top=_domTop;}else if (css && _def(ele.style.pixelLeft, ele.style.pixelTop)){cbe.left=_ieLeft; cbe.top=_ieTop;}else if (_def(ele.left, ele.top)){cbe.left=_nnLeft; cbe.top=_nnTop;}else{_sup(false,"left","top","moveTo","moveBy");}
  // width, height
  cbe.sizeTo=_cbeSizeTo; cbe.sizeBy=_cbeSizeBy; cbe.resizeTo=_cbeResizeTo; cbe.resizeBy=_cbeResizeBy; if (css && _def(ele.style.width, ele.style.height, ele.offsetWidth, ele.offsetHeight&& typeof(ele.style.width)=="string"){cbe.width=_domWidth; cbe.height=_domHeight;}else if (css && _def(ele.style.pixelWidth, ele.style.pixelHeight)){cbe.width=_ieWidth; cbe.height=_ieHeight;}else if (_def(ele.clip&& _def(ele.clip.width, ele.clip.height)){cbe.width=_nnWidth; cbe.height=_nnHeight;}else{_sup(false, "width","height","sizeTo","sizeBy","resizeTo","resizeBy");}
  // zIndex
  if (css && _def(ele.style.zIndex)){cbe.zIndex=_domZIndex;else if (_def(ele.zIndex)){cbe.zIndex=_nnZIndex;else{_sup(false,"zIndex");}
  // visibility
  cbe.show=_cbeShow; cbe.hide=_cbeHide; if (css && _def(ele.style.visibility)){cbe.visibility=_domVisibility;else if (_def(ele.visibility)){cbe.visibility=_nnVisibility;else{_sup(false,"visibility","show","hide");}
  // background
  if (css && _def(ele.style.backgroundColor, ele.style.backgroundImage)){cbe.background=_domBackground;else if (_def(ele.bgColor, ele.background)){cbe.background=_nnBackground;else{_sup(false,"background");}
  // color
  if (css && _def(ele.style.color)){cbe.color=_domColor;else{_sup(false,"color");}
  // clip
  if (css && _def(ele.style.clip)){cbe.clip=_domClip;else if (_def(ele.clip)){cbe.clip=_nnClip;else{_sup(false,"clip");}
  // offsetLeft, offsetTop
  if (_def(ele.offsetLeft, ele.offsetTop, ele.offsetParent)){cbe.offsetLeft=_ieOffsetLeft; cbe.offsetTop=_ieOffsetTop;}else if (_def(ele.pageX, ele.pageY)){cbe.offsetLeft=_nnOffsetLeft; cbe.offsetTop=_nnOffsetTop;}else{_sup(false,"offsetLeft","offsetTop");}
  // pageX, pageY
  cbe.contains=_cbeContains; if (_def(ele.pageX, ele.pageY)){cbe.pageX=_nnPageX; cbe.pageY=_nnPageY;}else if (document.cbe.isSupported("offsetLeft")){cbe.pageX=_cbePageX; cbe.pageY=_cbePageY;}else{_sup(false,"pageX","pageY","contains");}
  // innerHtml
  if (_def(ele.innerHTML)){cbe.innerHtml=_ieInnerHtml;else if (_def(ele.document&& _def(ele.document.write)){cbe.innerHtml=_nnInnerHtml;else{_sup(false,"innerHtml");}
  // scrollLeft, scrollTop
  if (_def(ele.scrollLeft, ele.scrollTop)){cbe.scrollLeft=_cbeScrollLeft; cbe.scrollTop=_cbeScrollTop;}else{_sup(false,"scrollLeft","scrollTop");}
  // createElement, appendChild, removeChild (these need more work)
  if (!_def(document.createElement&& !document.layers){_sup(false,"createElement","appendChild","removeChild");}else{if (!_def(ele.appendChild)){_sup(false,"appendChild");if (!_def(ele.removeChild)){_sup(false,"removeChild");}}
}
function cbeInitialize(sTagNames){
  var t,i,ele,eleList,cbe;
  cbe=new CrossBrowserElement(window);
  cbeBindElement(cbe, window);
  cbe=new CrossBrowserElement(document);
  cbeBindElement(cbe, document);
  if (!document.getElementByIddocument.getElementById=cbeGetElementById;
  if (document.createElement || document.layersdocument.cbe.createElement=_cbeCreateElement;
  document.cbe.isSupported=_cbeIsSupported;
  document.cbe.supported=new Array();
  _sup(true,"left","top","width","height","zIndex","show","hide","visibility","background","color","clip","offsetLeft","offsetTop","pageX","pageY","innerHtml","scrollLeft","scrollTop","createElement","appendChild","removeChild","moveTo","moveBy","sizeTo","sizeBy","resizeTo","resizeBy","contains");
  for (t=0; t < arguments.length; ++t){
    eleList=cbeGetElementsByTagName(arguments[t]);
    for (i=0; i < eleList.length; ++i){
      ele=eleList[i];
      if ele.id && ele.id !=""){
        cbe=new CrossBrowserElement();
        cbeBindElement(cbe, ele);
     }
   }
    if (document.layersbreak;
 }
  _cbeCreateTree();
  if (window.cbeEventJsLoaded && (document.layers || is.opera5or6)){window.cbe.addEventListener("resize", cbeDefaultResizeListener);}
}
function _cbeIsSupported(sMethods){var i; for (i=0; i<arguments.length; ++i){if (!document.cbe.supported[arguments[i]]) return false;}return true;}
function _sup(bValue, sMethods){var i; for (i=1; i<arguments.length; ++idocument.cbe.supported[arguments[i]]=bValue;}
function _cbeCreateTree(){var parent; for (var i=1; i < cbeAll.length; ++i){parent=cbeAll[i].parentElement; if (!parent.cbe){while (parent && !parent.cbe){parent=cbeGetParentElement(parent);}if (!parentparent=document;}parent.cbe.appendNode(cbeAll[i]);}}
function cbeGetElementById(sId){var ele=nullif (sId==window.cbeWindowIdele=window; else if (sId==window.cbeDocumentIdele=document; else if (is.dom1getbyidele=document.getElementById(sId)else if (document.allele=document.all[sId]else if (document.layersele=nnGetElementById(sId)if (!ele && window.cbeUtilJsLoaded){ele=cbeGetImageByName(sId)if (!ele){ele=cbeGetFormByName(sId);}} return ele;}
function nnGetElementById(sId){for (var i=0; i < cbeAll.length; i++){if cbeAll[i].id==sId return cbeAll[i].ele;}return null;}
function cbeGetElementsByTagName(sTagName){
  var eleList;
  if (document.getElementsByTagNameeleList=document.getElementsByTagName(sTagName)// standard
  else if (document.body && document.body.getElementsByTagNameeleList=document.body.getElementsByTagName(sTagName)// opera5or6
  else if (document.all && document.all.tagseleList=document.all.tags(sTagName)// ie4
  else if (document.layers){eleList=new Array(); nnGetAllLayers(window, eleList, 0);}// nn4
  return eleList;
}
function nnGetAllLayers(parent, layerArray, nextIndex){
  var i, layer;
  for (i=0; i < parent.document.layers.length; i++){
    layer=parent.document.layers[i]; layerArray[nextIndex++]=layer;
    if (layer.document.layers.lengthnextIndex=nnGetAllLayers(layer, layerArray, nextIndex);
 }
  return nextIndex;
}
function cbeGetParentElement(child){
  var parent=document;
  if (child==windowparent=null;
  else if (child==documentparent=window;
  else if (child.parentLayer){if (child.parentLayer !=windowparent=child.parentLayer;}
  else{
    if (child.parentNodeparent=child.parentNode;
    else if (child.offsetParentparent=child.offsetParent;
    else if (child.parentElementparent=child.parentElement;
 }
  return parent;
}
function _def(){var i; for (i=0; i<arguments.length; ++i){if (typeof(arguments[i])=="" || typeof(arguments[i])=="undefined"return false;}return true;}
function _retZero(){return 0;}
function _retNull(){return null;}
function _retEStr(){return "";}
function _retVoid(){}
////// when optimizing, don't remove anything above this comment //////
function _cbeCreateElement(sEleType){// returns an Element object
  var ele=null;
  if (document.createElement && sEleType.length){
    ele=document.createElement(sEleType);
    if (ele && ele.style){ele.style.position="absolute";}
 }
  else if (document.layers){
    ele=new Object();
 }
  return ele;
}
CrossBrowserNode.prototype.appendChild=function(eleChild){// returns the appended Element object on success
  var cbe, ele, rv=null;
  if (document.layers){
    var thisEle;
    if (this.index < 2thisEle=window;
    else thisEle=this.ele;
    ele=new Layer(this.width(), thisEle);
    if (ele){
      if (eleChild.idele.id=ele.name=eleChild.id;
      cbe=new CrossBrowserElement();
      cbeBindElement(cbe, ele);
      this.appendNode(ele.cbe);
      eleChild.cbe=cbe;
      ++this.childNodes;
      rv=ele;
   }
 }
  else{
    if (this.index < 2ele=document.body;
    else ele=this.ele;
    if (ele.appendChild){
      ele.appendChild(eleChild);
      cbe=new CrossBrowserElement();
      cbeBindElement(cbe, eleChild);
      this.appendNode(eleChild.cbe);
      ++this.childNodes;
      rv=eleChild;
   }
 }
  return rv;
}
CrossBrowserNode.prototype.removeChild=function(eleChild){
  var ele, rv=null;
  if (this.index < 2ele=document.body;
  else ele=this.ele;
  if (ele.removeChild || document.layers){
    --this.childNodes;
    var prevSib=eleChild.cbe.previousSibling;
    var nextSib=eleChild.cbe.nextSibling;
    with (eleChild.cbe){
      parentNode=null;
      previousSibling=null;
      nextSibling=null;
   }
    if (prevSibprevSib.nextSibling=nextSib;
    else this.firstChild=nextSib;
    if (nextSibnextSib.previousSibling=prevSib;
    else this.lastChild=prevSib;
    if (document.layers){
      //// working on it
   }
    else{
      ele.removeChild(eleChild);
   }
    rv=eleChild;
 }
  return rv;
}
function _cbeContains(iLeft, iTop, iClipTop, iClipRight, iClipBottom, iClipLeft){if (arguments.length==2){iClipTop=iClipRight=iClipBottom=iClipLeft=0;else if (arguments.length==3){iClipRight=iClipBottom=iClipLeft=iClipTop;else if (arguments.length==4){iClipLeft=iClipRight; iClipBottom=iClipTop;var thisX=this.pageX(), thisY=this.pageY()return iLeft >=thisX + iClipLeft && iLeft <=thisX + this.width() - iClipRight && iTop >=thisY + iClipTop && iTop <=thisY + this.height() - iClipBottom );}
function _cbeMoveTo(x_cr, y_mar, outside, xEndL){if (isFinite(x_cr)){this.left(x_cr)this.top(y_mar);}else{this.cardinalPosition(x_cr, y_mar, outside)this.left(this.x)this.top(this.y);}if (xEndLcbeEval(xEndL, this);}
function _cbeMoveBy(uDX, uDY, xEndL){if (uDX){this.left(this.left() + uDX);}  if (uDY){this.top(this.top() + uDY);if (xEndL){cbeEval(xEndL, this);}}
function _domLeft(iX){if (arguments.length){this.ele.style.left=iX + "px";else{iX=parseInt(this.ele.style.left)if (isNaN(iX)) iX=0;}return iX;}
function _ieLeft(iX){if (arguments.length){this.ele.style.pixelLeft=iX;else{iX=this.ele.style.pixelLeft;return iX;}
function _nnLeft(iX){if (arguments.length){this.ele.left=iX;else{iX=this.ele.left;return iX;}
function _domTop(iY){if (arguments.length){this.ele.style.top=iY + "px";else{iY=parseInt(this.ele.style.top)if (isNaN(iY)) iY=0;}return iY;}
function _ieTop(iY){if (arguments.length){this.ele.style.pixelTop=iY;else{iY=this.ele.style.pixelTop;return iY;}
function _nnTop(iY){if (arguments.length){this.ele.top=iY;else{iY=this.ele.top;return iY;}
function _nnOffsetLeft(){var ol=this.ele.pageX - this.parentElement.pageX; if (isNaN(ol)){ol=this.ele.pageX;return ol;}
function _nnOffsetTop(){var ot=this.ele.pageY - this.parentElement.pageY; if (isNaN(ot)){ot=this.ele.pageY;return ot;}
function _ieOffsetLeft(){var x=this.ele.offsetLeft, parent=this.ele.offsetParent; while(parent && !parent.cbe){x +=parent.offsetLeft; parent=parent.offsetParent;}return x;}
function _ieOffsetTop(){var y=this.ele.offsetTop, parent=this.ele.offsetParent; while(parent && !parent.cbe){y +=parent.offsetTop; parent=parent.offsetParent;}return y;}
function _nnPageX(){return this.ele.pageX;}
function _nnPageY(){return this.ele.pageY;}
function _cbePageX(){var x=this.offsetLeft(), parent=this.parentNode; if (parent){while(parent.index > 1){x +=parent.offsetLeft(); parent=parent.parentNode;}} return x;}
function _cbePageY(){var y=this.offsetTop(), parent=this.parentNode; if (parent){while(parent.index > 1){y +=parent.offsetTop(); parent=parent.parentNode;}} return y;}
function _cbeSizeTo(uW, uH){this.width(uW)this.height(uH);}
function _cbeSizeBy(iDW, iDH){this.width(this.width() + iDW)this.height(this.height() + iDH);}
function _cbeResizeTo(uW, uH, xEndListener){this.sizeTo(uW, uH)this.clip('auto'); cbeEval(xEndListener, this);}
function _cbeResizeBy(iDW, iDH, xEndListener){this.sizeBy(iDW, iDH)this.clip('auto'); cbeEval(xEndListener, this);}
function _domWidth(uW){if (arguments.length){uW=Math.round(uW); _domSetWidth(this.ele, uW);}return this.ele.offsetWidth;}
function _ieWidth(uW){if (arguments.length){uW=Math.round(uW)this.ele.style.pixelWidth=uW;}return this.ele.style.pixelWidth;}
function _nnWidth(uW){if (arguments.length){this.w=Math.round(uW)this.ele.clip.right=this.w;}return this.w;}
function _domHeight(uH){if (arguments.length){uH=Math.round(uH); _domSetHeight(this.ele, uH);}return this.ele.offsetHeight;}
function _ieHeight(uH){if (arguments.length){uH=Math.round(uH)this.ele.style.pixelHeight=uH;}return this.ele.style.pixelHeight;}
function _nnHeight(uH){if (arguments.length){this.h=Math.round(uH)this.ele.clip.bottom=this.h;}return this.h;}
function _domSetWidth(ele,uW){
  if (uW < 0return;
  var pl=0,pr=0,bl=0,br=0;
  if (_def(document.defaultView&& _def(document.defaultView.getComputedStyle)){// gecko and standard
    pl=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("padding-left"));
    pr=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("padding-right"));
    bl=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("border-left-width"));
    br=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue("border-right-width"));
 }
  else if (_def(ele.currentStyle, document.compatMode)){
    if (document.compatMode=="CSS1Compat"){// ie6up in css1compat mode
      pl=parseInt(ele.currentStyle.paddingLeft);
      pr=parseInt(ele.currentStyle.paddingRight);
      bl=parseInt(ele.currentStyle.borderLeftWidth);
      br=parseInt(ele.currentStyle.borderRightWidth);
   }
 }
  if (isNaN(pl)) pl=0if (isNaN(pr)) pr=0if (isNaN(bl)) bl=0if (isNaN(br)) br=0;
  var cssW=uW-(pl+pr+bl+br);
  if (isNaN(cssW|| cssW < 0return;
  ele.style.width=cssW + "px";
}
function _domSetHeight(ele,uH){
  if (uH < 0return;
  var pt=0,pb=0,bt=0,bb=0;
  if (_def(document.defaultView&& _def(document.defaultView.getComputedStyle)){
    pt=parseInt(document.defaultView.getComputedStyle(ele, "").getPropertyValue