Giovanni Rena: Calender-Script gibt keinen Rückgabewert

Beitrag lesen

  1. Teil

function makecal (selType) {  if (!selType)   selType = "year-";  selMonth = new Date(showYear, showMonth, 1);  preMonth = new Date(showYear, showMonth-1, 1);  postMonth= new Date(showYear, showMonth+1, 1);

var firstofMonth = selMonth.getDay();  if(firstofMonth==0) firstofMonth=7;  var monthnr = selMonth.getMonth();  var daystr="";  var dcol="";  var rows=0;  var counter=1;  var dayclick = "";

nrofdays=get_days(selMonth);  prenrofdays=get_days(preMonth);  preMonth.setMonth(showMonth-1);  postnrofdays=get_days(postMonth);  postMonth.setMonth(showMonth+1);

for(i=1;i<=firstofMonth-1;i++)  {   var tempint=prenrofdays-firstofMonth+i+1;   dcol="#606060";   fontw="";

if((counter)%7==1) daystr += "<tr>";   if((counter)%7==6) dcol="#600000";   if(tempint==thisDay && preMonth.getMonth()==thisMonth && showYear==thisYear) {fontw="<B>"; dcol="#c00000";}   else if(tempint==thisDay && preMonth.getMonth()==11 && preMonth.getMonth()==thisMonth && showYear-1==thisYear)   {    fontw="<B>";    dcol="#c00000";   }   dayclick = " onMouseover="releaseCap('past_"+i+"',true);" onMouseout="setCap('past_"+i+"')" onClick="calout("+tempint+",-1)"";   if (((counter)%7==0 || (counter)%7==6) && holnoclick)     dayclick = "";

daystr += "<td class="cal" " + dayclick + ">" +   "<table border="0" cellpadding="0" height="16" cellspacing="0" width="100%" style="border:1px solid #FFFFFF; border-bottom:0px;"><tr><td>"+   "<table border="0" cellpadding="0" height="14" cellspacing="0" width="100%">"+   "<tr><td class="caltbl" id="past_"+i+"" style="padding-left:1px;">"+   "<font class="cal" color="" + dcol + "">" + fontw + tempint + "</font>"+   "</td></tr></table></td></tr></table>"+   "</td>";

counter++;  }

for(i=1;i<=nrofdays;i++)  {   dcol=0;   fontw="";   if(rows == 0)    var strstyle = "border:1px solid #FFFFFF; border-bottom:0px;";   else    var strstyle = "border:1px solid #FFFFFF; border-bottom:0px; border-top:0px;";   if((counter)%7==1) daystr += "<tr>";   if((counter)%7==6 || (counter)%7==0) dcol="#900000";   if(i==thisDay && monthnr==thisMonth && showYear==thisYear) {fontw="<B>"; dcol="#c00000";}

dayclick = "onMouseover="releaseCap('now_"+i+"',true);" onMouseout="setCap('now_"+i+"')" onClick="calout("+i+",0)"";

if (((counter)%7==0 || (counter)%7==6) && holnoclick)     dayclick = "";

if((counter)%7==0)   {    daystr += "<td class="none" " + dayclick + ">"+       "<table border="0" height="16" cellpadding="0" cellspacing="0" width="100%" style=""+strstyle+""><tr><td>"+       "<table border="0" height="14" cellpadding="0" cellspacing="0" width="100%">"+       "<tr><td class="caltbl" id="now_"+i+"" style="padding-left:1px;">"+       "<font class="cal" color="" + dcol + "">" + fontw + i + "</font>"+       "</td></tr></table></td></tr></table>"+       "</td></tr>";    rows++;   }   else   {    daystr += "<td class="cal" " + dayclick + ">"+       "<table border="0" height="16" cellpadding="0" cellspacing="0" width="100%" style=""+strstyle+""><tr><td>"+       "<table border="0" height="14" cellpadding="0" cellspacing="0" width="100%">"+       "<tr><td class="caltbl" id="now_"+i+"" style="padding-left:1px;">"+       "<font class="cal" color="" + dcol + "">" + fontw + i + "</font>"+       "</td></tr></table></td></tr></table>"+       "</td>";   }   counter++;  }

for(i=1;counter<=42;i++)  {   if((counter)%7==1) daystr += "<tr>";   dcol="#606060";   fontw="";   if((counter)%7==6 || (counter)%7==0) dcol="#600000";   if(i==thisDay && postMonth.getMonth()==thisMonth && showYear==thisYear) {fontw="<B>"; dcol="#c00000";}   else if(i==thisDay && postMonth.getMonth()==0 && postMonth.getMonth()==thisMonth && showYear+1==thisYear)   {    fontw="<B>";    dcol="#c00000";   }   dayclick = " onMouseover="releaseCap('fut_"+i+"',true);" onMouseout="setCap('fut_"+i+"')" onClick="calout("+i+",1)"";   if (((counter)%7==0 || (counter)%7==6) && holnoclick)     dayclick = "";

if((counter)%7==0)   {    daystr += "<td class="none" " + dayclick + ">"+       "<table border="0" height="16" cellpadding="0" cellspacing="0" width="100%" style="border:1px solid #FFFFFF; border-top:0px; border-bottom:0px;"><tr><td>"+       "<table border="0" height="14" cellpadding="0" cellspacing="0" width="100%">"+       "<tr><td class="caltbl" id="fut_"+i+"" style="padding-left:1px;">"+       "<font class="cal" color="" + dcol + "">" + fontw + i + "</font>"+       "</td></tr></table></td></tr></table>"+       "</td></tr>";    rows++;   }   else   {    daystr += "<td class="cal" " + dayclick + ">"+       "<table border="0" height="16" cellpadding="0" cellspacing="0" width="100%" style="border:1px solid #FFFFFF; border-top:0px; border-bottom:0px;"><tr><td>"+       "<table border="0" height="14" cellpadding="0" cellspacing="0" width="100%">"+       "<tr><td class="caltbl" id="fut_"+i+"" style="padding-left:1px;">"+       "<font class="cal" color="" + dcol + "">" + fontw + i + "</font>"+       "</td></tr></table></td></tr></table>"+       "</td>";   }   counter++;  }

daystr += "</tr>";  document.getElementById ("calendar").innerHTML = conststr1 + conststr2 + daystr + conststr3; }

var captureCtrl = true; var selectionType = ""; function showSelection (type) {  selectionType = type;  captureCtrl = false;  releaseCap (null, false);  document.getElementById ("calendarSelect").style.top=calyPos;

if (type == "year-")  {   document.getElementById ("calendarSelect").style.left=calxPos + 40;   htmlText = "<select id="selection" style="width:56px; font-size:10px;" onBlur="selChange()" onChange="selChange()">";   for (i = thisYear + 10; i > thisYear - 70; i--)   {    htmlText += "<option value=" + i + (i == thisYear ? " selected" : "") + ">" + i + "</option>\r\n";   }   htmlText += "</select>";   document.getElementById ("calendarSelect").innerHTML = htmlText;  }

if (type == "year+")  {   document.getElementById ("calendarSelect").style.left=calxPos + 40;   htmlText = "<select id="selection" style="width:56px; font-size:10px;" onBlur="selChange()" onChange="selChange()">";   for (i = thisYear; i < thisYear + 10; i++)   {    htmlText += "<option value=" + i + ">" + i + "</option>\r\n";   }   htmlText += "</select>";   document.getElementById ("calendarSelect").innerHTML = htmlText;   document.getElementById ("selection").selectedIndex = 0;  }

if (type == "month")  {   document.getElementById ("calendarSelect").style.left=calxPos + 27;   htmlText = "<select id="selection" style="width:80px; font-size:10px;" onBlur="selChange()" onChange="selChange()">";   for (i = 0; i < 12; i++)   {    htmlText += "<option value=" + i + ">" + monthlist[i] + "</option>"   }   htmlText += "</select>";   document.getElementById ("calendarSelect").innerHTML = htmlText;   document.getElementById ("selection").selectedIndex = showMonth;  }  makecal ();  document.getElementById ("selection").focus (); }