este es el codigo:
Código js:
Ver original
<script language="JavaScript"> var gdCtrl = new Object(); var gcGray = "#BEBEBE"; var gcToggle = "#CCCCCC"; var gcBG = "#FFFFFF"; var gcdarkblue= "#CC0000"; var gdCurDate = new Date(); var giYear = gdCurDate.getFullYear(); var giMonth = gdCurDate.getMonth()+1; var giDay = gdCurDate.getDate(); var VicPopCal = new Object(); var diafechado; var mesfechado; var yearfechado; var overCerrar = "#CEC6A6"; function fPopCalendar(popCtrl, dateCtrl, popCal, year, month, day){ //parent.event.cancelBubble=true; VicPopCal = popCal; gdCtrl = dateCtrl; diafechado=day; mesfechado=month; yearfechado=year; fSetYearMon(year, month); var point = fGetXY(popCtrl); with (VicPopCal.style) { left = point.x+154+'px'; top = point.y-89+'px'; visibility = 'visible'; } VicPopCal.focus(); // in order to make compatible with IE4.x , here I cut two line below off. // VicPopCal.all("popFrame").width=document.all("popTable").offsetWidth; // VicPopCal.all("popFrame").height=document.all("popTable").offsetHeight; // if u only target on IE5.x, uncommented them and delete the width&height prop in <IFrame> tag // thus you will find the 3rd para in fDrawCal() now works perfectly. } function cerrar(){ VicPopCal.style.visibility = "hidden"; } function fSetDate(iYear, iMonth, iDay){ var meses = Array('', 'Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'); iMonth = meses[parseInt(iMonth)]; if (iDay<10) iDay = "0"+iDay; gdCtrl.value = iDay+"/"+iMonth+"/"+iYear; VicPopCal.style.visibility = "hidden"; } function fSetSelected(aCell, num){ var iOffset = 0; var iYear = parseInt(window.document.getElementById('tbSelYear').value); var iMonth = parseInt(window.document.getElementById('tbSelMonth').value); aCell.bgColor =gcBG; with (window.document.getElementById("cellText["+num+"]")) { //with (aCell.children[ "cellText["+num+"]" ]) { // var iDay = parseInt(innerText); // var iDay = parseInt(window.document.getElementById("cellText["+num+"]").value);} var browser=navigator.appName; if (browser=="Microsoft Internet Explorer"){ var iDay = window.document.getElementById("cellText["+num+"]").innerText; } else { var iDay = parseInt(innerHTML); } } if (!isNaN(iDay)) if (giYear<iYear) if (giMonth>iMonth) fSetDate(iYear, iMonth, iDay); else { if (giMonth==iMonth) { if (giDay>=iDay) fSetDate(iYear, iMonth, iDay); } } else if (giYear==iYear) if (giMonth<iMonth) fSetDate(iYear, iMonth, iDay); else if (giMonth==iMonth) if (giDay<=iDay) fSetDate(iYear, iMonth, iDay); } function Point(iX, iY){ this.x = iX-162; this.y = iY+23; } function fBuildCal(iYear, iMonth) { var aMonth=new Array(); for(i=1;i<7;i++) aMonth[i]=new Array(i); var dCalDate=new Date(iYear, iMonth-1, 1); var iDayOfFirst=dCalDate.getDay(); var iDaysInMonth=new Date(iYear, iMonth, 0).getDate(); var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1; var iDate = 1; var iNext = 1; for (d = 0; d < 7; d++) aMonth[1][d] = (d<iDayOfFirst)?" ":iDate++; for (w = 2; w < 7; w++) for (d = 0; d < 7; d++) aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:" "; return aMonth; } function fDrawCal(iYear, iMonth, iCellWidth, iDateTextSize) { var WeekDay = new Array("D","L","M","M","J","V","S"); var styleTD = " bgcolor='"+gcBG+"' width='"+iCellWidth+"' bordercolor='"+gcBG+"' valign='middle' align='center' class='calendario' "; with (document) { write("<tr>"); for(i=0; i<7; i++) write("<td "+styleTD+" ><b>" + WeekDay[i] + "</b></td>"); write("</tr>"); for (w = 1; w < 7; w++) { write("<tr>"); for (d = 0; d < 7; d++) { num=(7*w)+d; write("<td id=calCell"+(w+d)+ " "+styleTD+"' onMouseOver='this.bgColor=gcToggle' onMouseOut='this.bgColor=gcBG' onclick=fSetSelected(calCell"+(w+d)+ ","+num+")> "); write("<font id=cellText["+num+"] ></font>"); write("</td>") } write("</tr>"); } } } function fUpdateCal(iYear, iMonth) { myMonth = fBuildCal(iYear, iMonth); var i = 0; for (w = 0; w < 6; w++) for (d = 0; d < 7; d++) with (window.document.getElementById("cellText["+((7*(w+1))+d)+"]")) { //with (cellText[(7*w)+d]) { if (myMonth[w+1][d]<0) { color = gcGray; innerHTML = -myMonth[w+1][d]; }else{ if (giYear<iYear) if (giMonth>iMonth) { color = ((d==0)||(d==6))?"#AA0000":"black"; onClick = "javascript:"; innerHTML =myMonth[w+1][d]; } else { if (giMonth==iMonth) { if (giDay>=myMonth[w+1][d]) { color = ((d==0)||(d==6))?"#AA0000":"black"; innerHTML =myMonth[w+1][d]; } else { color = gcGray; innerHTML =myMonth[w+1][d]; } } else { color = gcGray; innerHTML =myMonth[w+1][d]; } } else if (giYear==iYear) { if (giMonth<iMonth) { color = ((d==0)||(d==6))?"#AA0000":"black"; innerHTML =myMonth[w+1][d]; } else { if (giMonth==iMonth) { if (giDay<=myMonth[w+1][d]) { color = ((d==0)||(d==6))?"#AA0000":"black"; innerHTML =myMonth[w+1][d]; } else { color = gcGray; innerHTML =myMonth[w+1][d]; } } else { color = gcGray; innerHTML =myMonth[w+1][d]; } } } if(giYear==iYear && giMonth==iMonth && giDay==myMonth[w+1][d]) { //fecha de hoy color = "#CC0000"; } if(iYear==yearfechado && iMonth==mesfechado && myMonth[w+1][d]==diafechado) { //fecha seleccionada color = "red"; bgColor="black"; } } } } function fSetYearMon(iYear, iMon){ window.document.getElementById('tbSelMonth').options[iMon-1].selected = true; //tbSelMonth.options[iMon-1].selected = true; for (i = 0; i < window.document.getElementById('tbSelYear').length; i++) // for (i = 0; i < tbSelYear.length; i++) if (window.document.getElementById('tbSelYear').options[i].value == iYear) // if (tbSelYear.options[i].value == iYear) window.document.getElementById('tbSelYear').options[i].selected = true; // tbSelYear.options[i].selected = true; fUpdateCal(iYear, iMon); } function fGetXY(aTag){ var oTmp = aTag; var pt = new Point(0,0); do { pt.x += oTmp.offsetLeft; pt.y += oTmp.offsetTop; oTmp = oTmp.offsetParent; } while(oTmp.tagName!="BODY"); return pt; } var gMonths = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); with (document) { //write("<p align=right > . </p>"); write("<BODY leftMargin=0 topMargin=0 > <p>"); write("<table id='popTable' border='0' >"); write("<TR>"); write("<td align='middle' align='center' >"); write(' <select name="tbSelMonth" id="tbSelMonth" onChange="fUpdateCal(window.document.getElementById('+"'tbSelYear'"+').value, window.document.getElementById('+"'tbSelMonth'"+').value)" class="fecha">'); for (i=0; i<12; i++) write("<option value='"+(i+1)+"'>"+gMonths[i]+"</option>"); write("</SELECT>"); write(' <SELECT name="tbSelYear" id="tbSelYear" onChange="fUpdateCal(window.document.getElementById('+"'tbSelYear'"+').value, window.document.getElementById('+"'tbSelMonth'"+').value)" class="fecha">'); for(i=giYear;i<=giYear+1;i++) write("<OPTION value='"+i+"'>"+i+"</OPTION>"); write("</SELECT> <font class='calendario' style='cursor:pointer; font-size: 14px; color:green;' onclick='cerrar()' onMouseOver='this.style.color=overCerrar' onMouseOut='this.style.color=gcdarkblue' valing='right'>| x |</font>"); write("</td>"); write("</TR><TR>"); write("<td align='center'>"); write("<DIV'><table width='100%' border='0' cellpadding='0' style='cursor:pointer;'>"); fDrawCal(giYear, giMonth, 19, 12); write("</table></DIV>"); write("</td>"); write("</TR><TR><TD align='center'>"); write("<font style='cursor:pointer; font:bold 12 Verdana ; color:#CC0000;' onclick='fSetDate(giYear,giMonth,giDay)' onMouseOver='this.style.color=overCerrar' onMouseOut='this.style.color=gcdarkblue; '>Hoy : "+giDay+" "+gMonths[giMonth-1]+", "+giYear+"</font><br>"); write("</TD></TR>"); write("</TD></TR>"); write("</TABLE>"); } </SCRIPT>
Y cual es el problema?
pues no puedo seleccionar las fechas anteriores al dia actual, supongo que debe ser alguna bobada que hay que modificar pero honestamente no eh dado con la solucion.