Foros del Web » Programando para Internet » Javascript »

Rollover que no funciona

Estas en el tema de Rollover que no funciona en el foro de Javascript en Foros del Web. Buenos dias!! Estoy haciendo una página web que necesita un calendario, y me he descargado uno muy chulo. Le he hecho algunas modificaciones, pero lo ...
  #1 (permalink)  
Antiguo 04/08/2008, 01:15
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Rollover que no funciona

Buenos dias!!
Estoy haciendo una página web que necesita un calendario, y me he descargado uno muy chulo. Le he hecho algunas modificaciones, pero lo que no consigo es que, al poner el raton sobre un día, le cambie el color del fondo.
¿Alguien me puede ayudar? Adjunto la parte central del código
Gracias!!

var monthName = new Array("Enero","Febrero","Marzo","Abril","Mayo","Ju nio","Julio","Agosto","Septiembre","Octubre","Novi embre","Diciembre")
var monthName2 = new Array("ENE","FEB","MAR","ABR","MAY","JUN","JUL","A GO","SEP","OCT","NOV","DIC")
if (startAt==0)
{
dayName = new Array ("Lun","Mar","Mie","Jue","Vie","Sab","Dom")
}
else
{
dayName = new Array ("Lun","Mar","Mie","Jue","Vie","Sab","Dom")
}
var styleAnchor="text-decoration:none;color:black;"
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,15) + " de " + yearNow + "</a>"
}

sHTML1="<span id='spanLeft' style='border-style:solid;border-width:1;border-color:#ffffff;cursor:pointer' title='"+scrollLeftMessage+"' onmouseover='swapImage(\"changeLeft\",\"left2.gif\ ");this.style.borderColor=\"#88AAFF\";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)'>&nbsp<IMG id='changeLeft' SRC='"+imgDir+"left1.gif' width=10 height=11 BORDER=0>&nbsp</span>&nbsp;"
sHTML1+="<span id='spanRight' style='border-style:solid;border-width:1;border-color:#ffffff;cursor:pointer' title='"+scrollRightMessage+"' onmouseover='swapImage(\"changeRight\",\"right2.gi f\");this.style.borderColor=\"#88AAFF\";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)'>&nbsp<IMG id='changeRight' SRC='"+imgDir+"right1.gif' width=10 height=11 BORDER=0>&nbsp</span>&nbsp"
sHTML1+="<span id='spanMonth' style='border-style:solid;border-width:1;border-color:#ffffff;cursor:pointer' title='"+selectMonthMessage+"' onmouseover='swapImage(\"changeMonth\",\"drop2.gif \");this.style.borderColor=\"#88AAFF\";window.stat us=\""+selectMonthMessage+"\"' onmouseout='swapImage(\"changeMonth\",\"drop1.gif\ ");this.style.borderColor=\"#ffffff\";window.statu s=\"\"' onclick='popUpMonth()'></span>&nbsp;"
sHTML1+="<span id='spanYear' style='border-style:solid;border-width:1;border-color:#fffffff;cursor:pointer' title='"+selectYearMessage+"' onmouseover='swapImage(\"changeYear\",\"drop2.gif\ ");this.style.borderColor=\"#88AAFF\";window.statu s=\""+selectYearMessage+"\"' onmouseout='swapImage(\"changeYear\",\"drop1.gif\" );this.style.borderColor=\"#ffffff\";window.status =\"\"' onclick='popUpYear()'></span>&nbsp;"

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 ;
}

function constructDate(d,m,y)
{
sTmp = dateFormat
sTmp = sTmp.replace ("dd","<e>")
sTmp = sTmp.replace ("d","<d>")
sTmp = sTmp.replace ("<e>",padZero(d))
sTmp = sTmp.replace ("<d>",d)
sTmp = sTmp.replace ("mmmm","<p>")
sTmp = sTmp.replace ("mmm","<o>")
sTmp = sTmp.replace ("mm","<n>")
sTmp = sTmp.replace ("m","<m>")
sTmp = sTmp.replace ("<m>",m+1)
sTmp = sTmp.replace ("<n>",padZero(m+1))
sTmp = sTmp.replace ("<o>",monthName[m])
sTmp = sTmp.replace ("<p>",monthName2[m])
sTmp = sTmp.replace ("yyyy",y)
return sTmp.replace ("yy",padZero(y%100))
}
function constructMonth() {
popDownYear()
if (!monthConstructed) {
sHTML = ""
for (i=0; i<12; i++) {
sName = monthName[i];
if (i==monthSelected){
sName = "<B>" + sName + "</B>"
}
sHTML += "<tr><td id='m" + i + "' onmouseover='this.style.backgroundColor=\"#FFCC99\ "' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='monthConstructed=false;monthSelected=" + i + ";constructCalendar();popDownMonth();event.cancelB ubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
}

document.getElementById("selectMonth").innerHTML = "<table width=70 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#FFFFDD' cellspacing=0 onmouseover='clearTimeout(timeoutID1)' onmouseout='clearTimeout(timeoutID1);timeoutID1=se tTimeout(\"popDownMonth()\",100);event.cancelBubbl e=true'>" + sHTML + "</table>"

monthConstructed=true
}
}
function constructCalendar () {
var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)

var dateMessage
var startDate = new Date (yearSelected,monthSelected,1)
var endDate

if (monthSelected==1)
{
endDate = new Date (yearSelected,monthSelected+1,1);
endDate = new Date (endDate - (24*60*60*1000));
numDaysInMonth = endDate.getDate()
}
else
{
numDaysInMonth = aNumDays[monthSelected];
}

datePointer = 0
dayPointer = startDate.getDay() - startAt

if (dayPointer<0)
{
dayPointer = 6
}

sHTML = "<table border=0 style='font-family:verdana;font-size:10px;'><tr>"



for (i=0; i<7; i++) {
sHTML += "<td width='27' align='right'><B>"+ dayName[i]+"</B></td>"
}
sHTML +="</tr><tr>"



for ( var i=1; i<=dayPointer;i++ )
{
sHTML += "<td>&nbsp;</td>"
}

for ( datePointer=1; datePointer<=numDaysInMonth; datePointer++ )
{
dayPointer++;
sHTML += "<td align=right>"
sStyle=styleAnchor
if ((datePointer==odateSelected) && (monthSelected==omonthSelected) && (yearSelected==oyearSelected))
{ sStyle+=styleLightBorder }

sHint = ""
for (k=0;k<HolidaysCounter;k++)
{
if ((parseInt(Holidays[k].d)==datePointer)&&(parseInt(Holidays[k].m)==(monthSelected+1)))
{
if ((parseInt(Holidays[k].y)==0)||((parseInt(Holidays[k].y)==yearSelected)&&(parseInt(Holidays[k].y)!=0)))
{
sStyle+="background-color:#FFDDDD;"
sHint+=sHint==""?Holidays[k].desc:"\n"+Holidays[k].desc
}
}
}

var regexp= /\"/g
sHint=sHint.replace(regexp,"&quot;")

dateMessage = "onmousemove='window.status=\""+selectDateMessage. replace("[date]",constructDate(datePointer,monthSelected,yearSele cted))+"\";' onmouseout='window.status=\"\"' "

var f1= new Date(yearSelected,monthSelected,datePointer);
//------------------------------------TERMINAR LA FUNCION EN 0 PARA QUE INICIE EN EL DIA ACTUAL EN LA SIGUIENTE LINEA----------------------------------------------
var temp = addToDate(makeDateFormat(dateNow, monthNow, yearNow),0);
var nDia = Number(temp.substr(0, 2));
var nMes = Number(temp.substr(3, 2));
var nAno = Number(temp.substr(6, 4));
var fa= new Date(nAno,nMes,nDia);

if ((datePointer==nDia)&&(monthSelected==nMes)&&(year Selected==nAno))
//{ sHTML += "<b style='"+sStyle+"'><font color=#ff0000>&nbsp;" + datePointer + "</font>&nbsp;</b>"}
{ sHTML += "<b><a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer+";clos eCalendar();' ><font color=#ff0000>&nbsp;" + datePointer + "</font>&nbsp;</a></b>"}
//else if (dayPointer % 7 == (startAt * -1)+1)
//{ sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;<font color=#909090>" + datePointer + "</font>&nbsp;</a>" }
else if (FechaMenor(fa,f1)) //((datePointer<dateNow)&&(monthSelected<=monthNow)& &(yearSelected=yearNow))
{ sHTML += "&nbsp;<font color=#909090>" + datePointer + "</font>&nbsp;" }
else
{ sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;" + datePointer + "&nbsp;</a>" }

sHTML += ""
if ((dayPointer+startAt) % 7 == startAt) {
sHTML += "</tr><tr>"

}
}

document.getElementById("content").innerHTML = sHTML
document.getElementById("spanMonth").innerHTML = "&nbsp;" + monthName[monthSelected] + "&nbsp;<IMG id='changeMonth' SRC='"+imgDir+"drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
document.getElementById("spanYear").innerHTML = "&nbsp;" + yearSelected + "&nbsp;<IMG id='changeYear' SRC='"+imgDir+"drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:14.