el codigo que tengo en la pagina es el siguiente:
Código HTML:
<script language='javascript' src='popcalendar.js'></script>
Fecha
<input name="fecha" type="text" class="cont_plain" id="fecha" onFocus="popUpCalendar(this, fecha, 'dd/mm/yyyy')" size="12" readonly=readonly>
y la pagina popcalendar.js es el siguiente:
[HTML] var fixedX = -1 // x position (-1 if to appear below control)
var fixedY = -1 // y position (-1 if to appear below control)
var startAt = 0 // 0 - sunday ; 1 - monday
var showWeekNumber = 0 // 0 - don't show; 1 - show
var showToday = 1 // 0 - don't show; 1 - show
var imgDir = "/images/" // directory for images ... e.g. var imgDir="/img/"
var gotoString = "Ir al día de hoy"
var todayString = "Hoy es"
var weekString = "Sem"
var scrollLeftMessage = "Click al scroll para ir al mes anterior. Mantener el botón del ratón para cambiar automaticamente."
var scrollRightMessage = "Click al scroll para ir al proximo mes. Mantener el botón del ratón para cambiar automaticamente."
var selectMonthMessage = "Click para seleccionar mes"
var selectYearMessage = "Click para seleccionar año"
var selectDateMessage = "Seleciona [date] como fecha." // do not replace [date], it will be replaced by date.
var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear
var bPageLoaded=false
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var today = new Date()
var dateNow = today.getDate()
var monthNow = today.getMonth()
var yearNow = today.getYear()
var imgsrc = new Array("drop1.gif","drop2.gif","left1.gif","left2.g if","right1.gif","right2.gif")
var img = new Array()
var bShow = false;
//configuracion de los colores
var color_holiday="#003399;"
var color_fondo_header="#4F74F2"
var color_numero_dias="black;"
var color_bordes_gif="white;"
var color_fin_semana="#909090"
var border_tabla_principal="white"
var color_letras_header="white"
var color_fondo_tabla="#C5DEFE"
/* hides <select> and <applet> objects (for IE only) */
function hideElement( elmID, overDiv )
{
if( ie )
{
for( i = 0; i < document.all.tags( elmID ).length; i++ )
{
obj = document.all.tags( elmID )[i];
if( !obj || !obj.offsetParent )
{
continue;
}
// Find the element's offsetTop and offsetLeft relative to the BODY tag.
objLeft = obj.offsetLeft;
objTop = obj.offsetTop;
objParent = obj.offsetParent;
while( objParent.tagName.toUpperCase() != "BODY" )
{
objLeft += objParent.offsetLeft;
objTop += objParent.offsetTop;
objParent = objParent.offsetParent;
}
objHeight = obj.offsetHeight;
objWidth = obj.offsetWidth;
if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
else if( overDiv.offsetTop >= ( objTop + objHeight ));
else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
else
{
obj.style.visibility = "hidden";
}
}
}
}
/*
* unhides <select> and <applet> objects (for IE only)
*/
function showElement( elmID )
{
if( ie )
{
for( i = 0; i < document.all.tags( elmID ).length; i++ )
{
obj = document.all.tags( elmID )[i];
if( !obj || !obj.offsetParent )
{
continue;
}
obj.style.visibility = "";
}
}
}
function HolidayRec (d, m, y, desc)
{
this.d = d
this.m = m
this.y = y
this.desc = desc
}
var HolidaysCounter = 0
var Holidays = new Array()
function addHoliday (d, m, y, desc)
{
Holidays[HolidaysCounter++] = new HolidayRec ( d, m, y, desc )
}
if (dom)
{
for (i=0;i<imgsrc.length;i++)
{
img[i] = new Image
img[i].src = imgDir + imgsrc[i]
}
//aqui va la tabla principal
document.write ("<div onclick='bShow=true' id='calendar' style='z-index:+999;position:absolute;visibility:hidden;'>< table width="+((showWeekNumber==1)?250:220)+" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#a0a0a0;font-family:arial; font-size:11px}' bgcolor='"+border_tabla_principal+"'><tr bgcolor='"+color_fondo_header+"'><td><table width='"+((showWeekNumber==1)?248:218)+"'><tr><td style='padding:2px;font-family:arial; font-size:11px;'><font color='"+color_letras_header+"'><B><span id='caption'></span></B></font></td><td align=right><a href='javascript
:hideCalendar()'><IMG SRC='"+imgDir+"close.gif' WIDTH='15' HEIGHT='13' BORDER='0' ALT='Cerrar el calendario'></a></td></tr></table></td></tr><tr><td style='padding:5px' bgcolor='"+color_fondo_tabla+"'><span id='content'></span></td></tr>")
if (showToday==1)
{
document.write ("<tr bgcolor=#f0f0f0><td style='padding:5px' align=center><span id='lblToday'></span></td></tr>")
}
document.write ("</table></div><div id='selectMonth' style='z-index:+999;position:absolute;visibility:hidden;'></div><div id='selectYear' style='z-index:+999;position:absolute;visibility:hidden;'></div>");
}
var monthName = new Array("Enero","Febrero","Marzo","Abril","Mayo","Ju nio","Julio","Agosto","Septiembre","Octubre","Novi embre","Diciembre")
if (startAt==0)
{
dayName = new Array ("Dom","Lun","Mar","Mie","Jue","Vie","Sab")
}
else
{
dayName = new Array ("Lun","Mar","Mie","Jue","Vie","Sab","Dom")
}
var styleAnchor="text-decoration:none;color:"+color_numero_dias //fuente de los numeros de los dias
var styleLightBorder="border-style:solid;border-width:1px;border-color:#a0a0a0;"
function swapImage(srcImg, destImg){
if (ie) { document.getElementById(srcImg).setAttribute("src" ,imgDir + destImg) }
}
function init() {
if (!ns4)
{
if (!ie) { yearNow += 1900 }
crossobj=(dom)?document.getElementById("calendar") .style : ie? document.all.calendar : document.calendar
hideCalendar()
crossMonthObj=(dom)?document.getElementById("selec tMonth").style : ie? document.all.selectMonth : document.selectMonth
crossYearObj=(dom)?document.getElementById("select Year").style : ie? document.all.selectYear : document.selectYear
monthConstructed=false;
yearConstructed=false;
if (showToday==1)
{
document.getElementById("lblToday").innerHTML = todayString + " <a onmousemove='window.status=\""+gotoString+"\"' onmouseout='window.status=\"\"' title='"+gotoString+"' style='"+styleAnchor+"' href='javascript
:monthSelected=monthNow;yearSelect ed=yearNow;constructCalendar();'>"+dayName[(today.getDay()-startAt==-1)?6:(today.getDay()-startAt)]+", " + dateNow + " " + monthName[monthNow].substring(0,3) + " " + yearNow + "</a>"
}
//aqui va los bordes de las flechas, mes y año
sHTML1="<span id='spanLeft' style='border-style:solid;border-width:1;border-color:"+color_bordes_gif+"cursor:pointer' onmouseover='swapImage(\"changeLeft\",\"left2.gif\ ");this.style.borderColor=\"#ffffff\";window.statu s=\""+scrollLeftMessage+"\"' onclick='javascript
:decMonth()' onmouseout='clearInterval(intervalID1);swapImage(\ "changeLeft\",\"left1.gif\");this.style.borderColo r=\"#FFFFFF\";window.status=\"\"' onmousedown='clearTimeout(timeoutID1);timeoutID1=s etTimeout(\"StartDecMonth()\",500)' onmouseup='clearTimeout(timeoutID1);clearInterval( intervalID1)'> <IMG id='changeLeft' SRC='"+imgDir+"left1.gif' width=10 height=11 BORDER=0> </span> "
sHTML1+="<span id='spanRight' style='border-style:solid;border-width:1;border-color:"+color_bordes_gif+"cursor:pointer' onmouseover='swapImage(\"changeRight\",\"right2.gi f\");this.style.borderColor=\"#ffffff\";window.sta tus=\""+scrollRightMessage+"\"' onmouseout='clearInterval(intervalID1);swapImage(\ "changeRight\",\"right1.gif\");this.style.borderCo lor=\"#FFFFFF\";window.status=\"\"' onclick='incMonth()' onmousedown='clearTimeout(timeoutID1);timeoutID1=s etTimeout(\"StartIncMonth()\",500)' onmouseup='clearTimeout(timeoutID1);clearInterval( intervalID1)'> <IMG id='changeRight' SRC='"+imgDir+"right1.gif' width=10 height=11 BORDER=0> </span> "
sHTML1+="<span id='spanMonth' style='border-style:solid;border-width:1;border-color:"+color_bordes_gif+"cursor:pointer' onmouseover='swapImage(\"changeMonth\",\"drop2.gif \");this.style.borderColor=\"#ffffff\";window.stat us=\""+selectMonthMessage+"\"' onmouseout='swapImage(\"changeMonth\",\"drop1.gif\ ");this.style.borderColor=\"#FFFFFF\";window.statu s=\"\"' onclick='popUpMonth()'></span> "
sHTML1+="<span id='spanYear' style='border-style:solid;border-width:1;border-color:"+color_bordes_gif+"cursor:pointer' onmouseover='swapImage(\"changeYear\",\"drop2.gif\ ");this.style.borderColor=\"#ffffff\";window.statu s=\""+selectYearMessage+"\"' onmouseout='swapImage(\"changeYear\",\"drop1.gif\" );this.style.borderColor=\"#FFFFFF\";window.status =\"\"' onclick='popUpYear()'></span> "
document.getElementById("caption").innerHTML = sHTML1
bPageLoaded=true
}
}
function hideCalendar() {
crossobj.visibility="hidden"
if (crossMonthObj != null){crossMonthObj.visibility="hidden"}
if (crossYearObj != null){crossYearObj.visibility="hidden"}
showElement( 'SELECT' );
showElement( 'APPLET' );
}
function padZero(num) {
return (num < 10)? '0' + num : num ;
}