Ich hätte hier eine Frage zu diesem Kalenderscipt. Ich hätte gerne, dass bei einem Mousover ein Hover erscheint, welches ein Event ausgibt, habe aber keine Ahnung wie ich das umsetzen könnte. Hoffe, dass mir jemand von euch helfen kann.
Danke im Voraus
Allmi02
Danke im Voraus
Allmi02
Code:
function CalendarJS() {
this.now = new Date();
this.dayname = ["Mo","Di","Mi","Do","Fr","Sa","So"];
this.monthname = ["Januar","Februar","M\u00e4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"];
this.tooltip = ["vorheriger Monat","n\u00e4chster Monat","aktuelles Datum","vorheriges Jahr","n\u00e4chstes Jahr"];
this.monthCell = document.createElement("th");
this.tableHead = null;
this.tableFoot = null;
this.parEl = null;
this.init = function( id, initDate ) {
this.now = initDate?initDate:new Date();
this.date = this.now.getDate();
this.month = this.mm = this.now.getMonth();
this.year = this.yy = this.now.getFullYear();
this.monthCell.appendChild(document.createTextNode( this.monthname[this.mm]+"\u00a0"+this.yy ));
this.tableHead = this.createTableHead();
this.tableFoot = this.createTableFoot();
this.parEl = document.getElementById( id );
this.show();
if (!initDate) this.checkDate();
},
this.checkDate = function() {
var self = this;
var today = new Date();
if (this.date != today.getDate()) {
this.tableHead = this.createTableHead();
this.tableFoot = this.createTableFoot();
this.date = today.getDate();
if (this.mm == this.month && this.yy == this.year)
this.switchMonth("current");
this.month = today.getMonth();
if (this.mm == this.month && this.yy == this.year)
this.switchMonth("current");
this.year = today.getFullYear();
if (this.mm == this.month && this.yy == this.year)
this.switchMonth("current");
}
window.setTimeout(function() { self.checkDate(); }, Math.abs(new Date(this.year, this.month, this.date, 24, 0, 0)-this.now));
},
this.removeElements = function( Obj ) {
while( Obj.childNodes.length > 0)
Obj.removeChild(Obj.childNodes[Obj.childNodes.length-1]);
return Obj;
},
this.show = function() {
this.parEl = this.removeElements( this.parEl );
this.monthCell.firstChild.replaceData(0, this.monthCell.firstChild.nodeValue.length, this.monthname[this.mm]+"\u00a0"+this.yy);
var table = document.createElement("table");
table.appendChild( this.createTableBody() );
table.appendChild( this.tableHead );
table.appendChild( this.tableFoot );
this.parEl.appendChild( table );
},
this.createTableFoot = function() {
var tfoot = document.createElement("tfoot");
var tr = document.createElement("tr");
var td = this.getCell( "td", "KW\u00a0" + this.getCalendarWeek(this.year, this.month, this.date), "calendar_week" );
td.colSpan = 3;
tr.appendChild( td );
var td = this.getCell( "td", this.timeTrigger(), "clock" );
td.colSpan = 4;
tr.appendChild( td );
tfoot.appendChild( tr );
var self = this;
window.setInterval(function() { td.firstChild.nodeValue = self.timeTrigger(); }, 500);
return tfoot;
}
this.createTableHead = function() {
var thead = document.createElement("thead");
var tr = document.createElement("tr");
var th = this.getCell( "th", "\u00AB", "prev_month" );
th.rowSpan = 2;
th.Instanz = this;
th.onclick = function() { this.Instanz.switchMonth("prev"); };
th.title = this.tooltip[0];
try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; }
tr.appendChild( th );
this.monthCell.Instanz = this;
this.monthCell.rowSpan = 2;
this.monthCell.colSpan = 4;
this.monthCell.onclick = function() { this.Instanz.switchMonth("current"); };
this.monthCell.title = this.tooltip[2];
try { this.monthCell.style.cursor = "pointer"; } catch(e){ this.monthCell.style.cursor = "hand"; }
tr.appendChild( this.monthCell );
th = this.getCell( "th", "\u00BB", "next_month" );
th.rowSpan = 2;
th.Instanz = this;
th.onclick = function() { this.Instanz.switchMonth("next"); };
th.title = this.tooltip[1];
try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; }
tr.appendChild( th );
th = this.getCell( "th", "\u02c4", "prev_year" );
th.Instanz = this;
th.onclick = function() { this.Instanz.switchMonth("prev_year"); };
th.title = this.tooltip[3];
try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; }
tr.appendChild( th );
thead.appendChild( tr );
tr = document.createElement("tr");
th = this.getCell( "th", "\u02c5", "next_year" )
th.Instanz = this;
th.onclick = function() { this.Instanz.switchMonth("next_year"); };
th.title = this.tooltip[4];
try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; }
tr.appendChild( th );
thead.appendChild( tr );
tr = document.createElement('tr');
for (var i=0; i<this.dayname.length; i++)
tr.appendChild( this.getCell("th", this.dayname[i], "weekday" ) );
thead.appendChild( tr );
return thead;
},