Foros del Web » Programando para Internet » Javascript »

Orden de los días de la semana - 1ª parte

Estas en el tema de Orden de los días de la semana - 1ª parte en el foro de Javascript en Foros del Web. Hola a todo el que entre en este tema: A partir de los siguientes dos bloques de código, cada uno de los cuáles forma un ...
  #1 (permalink)  
Antiguo 26/10/2005, 05:56
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 1ª parte

Hola a todo el que entre en este tema:

A partir de los siguientes dos bloques de código, cada uno de los cuáles forma un archivo, se construye un calendario con sus vínculos para ir al mes anterior/próximo y año anterior/próximo. De manera predeterminada, aparece el mes actual.

Tiene un límite para no pasar más del año actual+5, y hacia atrás otro límite para no ir más allá del mes actual.
Si se quitan esos límites, establecidos a través de 'if', el calendario es infinito.

Pero, bueno, alguien ya se estará preguntando ¿cuál es el problema planteado?
Se trata del orden de los días de la semana.

Este código venía con una página que, en su día, me descargue. Más ó menos, he descifrado como funciona todo. Pero no como hacer para que el primer día de la semana sea el LUNES y no el DOMINGO como está programado.

Ahí van los dos bloques de código, cada uno con su nombre de archivo.
El 'prueba_Calendar_Fin.asp' lo tengo dentro de una carpeta llamada 'admin' y está vinculado a 'overlib_mini.js'.
El 'overlib_mini.js' lo tengo dentro de una carpeta llamada 'css_js'.

(Fin de la 1ª parte - Sigue en la 2ª)
  #2 (permalink)  
Antiguo 26/10/2005, 06:01
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 2ª parte

INICIO de 'prueba_Calendar_Fin.asp'
================================================== ========

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Prueba Calendario</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../css_js/euskalbid.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
<!--
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var ver;
if (bName == "Netscape" && bVer >= 4) {
ver = 4;
} else if (bName == "Microsoft Internet Explorer" && bVer >= 4) {
ver = 4;
} else {
ver = 0;
}

//-->
</script>

<script language="javascript" type="text/javascript">
<!--
//NUMERANDO DE 0 a 6 LOS DÍAS DE LA SEMANA, SE INDICA CUALES SE SEÑALARÁN COMO FIN DE SEMANA
var weekend = [5,6];
var weekendColor = "#e0eafc"; //Color de Fondo de los días de FindeSemana, y casillas Año+- Mes+-
var fontface = "Arial, Helvetica, sans-serif";
var fontsize = 8;

var gNow = new Date();
var ggWinContent;
var ggPosX = 50;
var ggPosY = 50;

var vNowDay = gNow.getDate();
var vNowMonth = gNow.getMonth(); // El número resultante va de 0 a 11
var vNowYear = gNow.getFullYear();

Calendar.Months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];

// Nº de días en año NO bisiesto
Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Nº de días en año bisiesto
Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

/*
CONSTRUCCIÓN DEL CALENDARIO SEGÚN DATOS ENVIADOS
AL PINCHAR EN Año- | Mes- | Mes+ | Año+
*/
function Calendar(p_item, p_month, p_year, p_format) {
if ((p_month == null) && (p_year == null)) return;

if (p_month == null) {
this.gMonthName = null;
this.gMonth = null;
this.gYearly = true;
} else {
/*
EL SIGUIENTE if...else SIRVE PARA CONTROLAR QUE AL HECHAR
HACIA ATRÁS EL AÑO (Año-), COMO MUCHO, SE ECHE HACIA ATRÁS
HASTA EL MES ACTUAL
*/
if ((p_month <= vNowMonth) && (p_year == vNowYear)) {
this.gMonthName = Calendar.get_month(vNowMonth);
this.gMonth = new Number(vNowMonth);
this.gYearly = false;
}
else {
this.gMonthName = Calendar.get_month(p_month);
this.gMonth = new Number(p_month);
this.gYearly = false;
}
}

this.gYear = p_year;
this.gFormat = p_format;
this.gBGColor = "white";
this.gFGColor = "black";
this.gTextColor = "black";
this.gHeaderColor = "black";
this.gReturnItem = p_item;
}/*
FIN DE CONSTRUCCIÓN DEL CALENDARIO SEGÚN DATOS ENVIADOS
AL PINCHAR EN Año- | Mes- | Mes+ | Año+
*/

Calendar.get_month = Calendar_get_month;
Calendar.get_daysofmonth = Calendar_get_daysofmonth;
Calendar.calc_month_year = Calendar_calc_month_year;

function Calendar_get_month(monthNo) {
return Calendar.Months[monthNo];
}

function Calendar_get_daysofmonth(monthNo, p_year) {
/*
Chequeo para año bisiesto
1. Los años divisibles por cuatro son años bisiestos, a excepción de
2. Los años también divisibles por 100 no son años bisiestos, a excepción de
3. Los años también divisibles por 400 son años bisiestos.
*/
if ((p_year % 4) == 0) {
if ((p_year % 100) == 0 && (p_year % 400) != 0)
return Calendar.DOMonth[monthNo];

return Calendar.lDOMonth[monthNo];
} else
return Calendar.DOMonth[monthNo];
}

function Calendar_calc_month_year(p_Month, p_Year, incr) {
/*
Devolverá un array de una dimensión. El primer elemento es el mes calculado y el
segundo el año calculado después de aplicar el mes incrementado/decrementrado como el
parámetro 'incr'.
*/
var ret_arr = new Array();

if (incr == -1) {
// Hacia atrás
if (p_Month == 0) {
ret_arr[0] = 11;
ret_arr[1] = parseInt(p_Year) - 1;
}
else {
ret_arr[0] = parseInt(p_Month) - 1;
ret_arr[1] = parseInt(p_Year);
}
} else if (incr == 1) {
// Hacia delante
if (p_Month == 11) {
ret_arr[0] = 0;
ret_arr[1] = parseInt(p_Year) + 1;
}
else {
ret_arr[0] = parseInt(p_Month) + 1;
ret_arr[1] = parseInt(p_Year);
}
}

return ret_arr;
}

// Esto es para compatibilidad con Navigator 3
new Calendar();

Calendar.prototype.getMonthlyCalendarCode = function() {
var vCode = "";
var vHeader_Code = "";
var vData_Code = "";

// Empezar a dibujar la tabla
vCode += ("<div align=\"center\"><table border=\"1\" cellspacing=\"1\" cellpadding=\"1\" bordercolor=\"#204368\" bgcolor=\"" + this.gBGColor + "\" style=\"font-size:" + fontsize + "pt;\">");

vHeader_Code = this.cal_header();
vData_Code = this.cal_data();
vCode += (vHeader_Code + vData_Code);

vCode += "</table></div>";

return vCode;
}

/*
Función que Contiene la Tabla de Vínculos: Año- | Mes- | Mes+ | Año+
*/
Calendar.prototype.show = function() {
var vCode = "";

// Meter el contenido en la variable global ggWinContent
ggWinContent += ("<span style=\"font-family:" + fontface + "; font-weight:bold;\">");
ggWinContent += (this.gMonthName + " " + this.gYear);
ggWinContent += "<br />";

// Mostrar los botones de navegación
var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
var prevMM = prevMMYYYY[0];
var prevYYYY = prevMMYYYY[1];

var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
var nextMM = nextMMYYYY[0];
var nextYYYY = nextMMYYYY[1];

/*
FORMATO PARA EL NÚMERO DEL DÍA
Si es el ACTUAL, se pone en ROJO y NEGRITA
*/
Calendar.prototype.format_day = function(vday) {
if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
return ("<span style=\"color:red; font-weight:bold;\">" + vday + "</span>");
else
return (vday);
}/*
FIN DE FORMATO PARA EL NÚMERO DEL DÍA
*/


(Fin de la 2ª parte - Sigue en la 3ª)
  #3 (permalink)  
Antiguo 26/10/2005, 06:03
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 3ª parte

/*
Tabla de Vínculos: Año- | Mes- | Mes+ | Año+
#204368 => Color de los Bordes de la tabla (Azul Marino)
#e0eafc => Color de Fondo de las Casillas de Vínculos (Azul Claro)
*/
ggWinContent += ("<table width=\"100%\" border=\"1\" cellspacing=\"1\" bordercolor=\"#204368\" cellpadding=\"1\" bgcolor=\"#ffffff\" style=\"font-size:" + fontsize + "pt;\"><tr><td style=\"text-align:center; background-color:#e0eafc;\">");

/*
EL SIGUIENTE if...else CONTROLA EL PRIMER AÑO DESDE EL QUE SE NAVEGA
si elAñoNavegado es igual al añoActual entonces no se siguen restando años
(Se hace lo mismo para los Vínculos de Mes- , Mes+ ó Año+)
*/
if (this.gYear == vNowYear) {
ggWinContent += ("&lt;&lt;A&ntilde;o");
}
else {
ggWinContent += ("<a href=\"javascript:void(0);\" " +
"onmouseover=\"window.status='Un año menos'; return true;\" " +
"onmouseout=\"window.status=''; return true;\" " +
"onclick=\"Build(" +
"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "'" +
");" +
"\">&lt;&lt;A&ntilde;o<\/a>");
}
ggWinContent += ("</td><td style=\"text-align:center; background-color:#e0eafc;\">");

/*
si elMesNavegado es igual al mesActual Y elAñoNavegado es igual al añoActual
entonces no se siguen restando meses
*/
if (this.gMonth == vNowMonth && this.gYear == vNowYear) {
ggWinContent += ("&lt;&lt;Mes");
}
else {
ggWinContent += ("<a href=\"javascript:void(0);\" " +
"onmouseover=\"window.status='Un mes menos'; return true;\" " +
"onmouseout=\"window.status=''; return true;\" " +
"onclick=\"Build(" +
"'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "'" +
");" +
"\">&lt;&lt;Mes<\/a>");
}
ggWinContent += ("</td><td style=\"text-align:center; background-color:#e0eafc;\">");

/*
si elMesNavegado es igual al referido a Diciembre Y elAñoNavegado es igual al añoActual+5
entonces no se siguen sumando meses
*/
if (this.gMonth == 11 && this.gYear == vNowYear+5) {
ggWinContent += ("Mes&gt;&gt;");
}
else {
ggWinContent += ("<a href=\"javascript:void(0);\" " +
"onMouseOver=\"window.status='Un mes más'; return true;\" " +
"onMouseOut=\"window.status=''; return true;\" " +
"onClick=\"Build(" +
"'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "'" +
");" +
"\">Mes&gt;&gt;<\/a>");
}
ggWinContent += ("</td><td style=\"text-align:center; background-color:#e0eafc;\">");

/*
si elAñoNavegado es igual al añoActual+5
entonces no se siguen sumando años
*/
if (this.gYear == vNowYear+5) {
ggWinContent += ("A&ntilde;o&gt;&gt;");
}
else {
ggWinContent += ("<a href=\"javascript:void(0);\" " +
"onMouseOver=\"window.status='Un año más'; return true;\" " +
"onMouseOut=\"window.status=''; return true;\" " +
"onClick=\"Build(" +
"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "'" +
");" +
"\">A&ntilde;o&gt;&gt;<\/a>");
}
ggWinContent += ("</td></tr></table><br />");
// Fin de Tabla de Vínculos: Año- | Mes- | Mes+ | Año+

// Código completo de calendario para el mes y añadirlo a la variable

vCode = this.getMonthlyCalendarCode();
ggWinContent += vCode;
}/*
Fin de Función que Contiene la Tabla de Vínculos: Año- | Mes- | Mes+ | Año+
*/

/*
CABECERA CON LOS DÍAS DE LA SEMANA
*/

Calendar.prototype.cal_header = function() {
var vCode = "";

vCode = vCode + "<tr>";
vCode = vCode + "<td width=\"14%\" style=\"text-align:center; background-color:#204368; font-weight:bold; font-family:" + fontface + "; color:" + this.gHeaderColor + ";\">DOM</td>";
vCode = vCode + "<td width=\"14%\" style=\"text-align:center; background-color:#204368; font-weight:bold; font-family:" + fontface + "; color:" + this.gHeaderColor + ";\">LUN</td>";
vCode = vCode + "<td width=\"14%\" style=\"text-align:center; background-color:#204368; font-weight:bold; font-family:" + fontface + "; color:" + this.gHeaderColor + ";\">MAR</td>";
vCode = vCode + "<td width=\"14%\" style=\"text-align:center; background-color:#204368; font-weight:bold; font-family:" + fontface + "; color:" + this.gHeaderColor + ";\">MIE</td>";
vCode = vCode + "<td width=\"14%\" style=\"text-align:center; background-color:#204368; font-weight:bold; font-family:" + fontface + "; color:" + this.gHeaderColor + ";\">JUE</td>";
vCode = vCode + "<td width=\"14%\" style=\"text-align:center; background-color:#204368; font-weight:bold; font-family:" + fontface + "; color:" + this.gHeaderColor + ";\">VIE</td>";
vCode = vCode + "<td width=\"14%\" style=\"text-align:center; background-color:#204368; font-weight:bold; font-family:" + fontface + "; color:" + this.gHeaderColor + ";\">SAB</td>";
vCode = vCode + "</tr>";

return vCode;
}/*
FIN DE CABECERA CON LOS DÍAS DE LA SEMANA
*/


Calendar.prototype.cal_data = function() {
var vDate = new Date();
vDate.setDate(1);
vDate.setMonth(this.gMonth);
vDate.setFullYear(this.gYear);

var vFirstDay=vDate.getDay();
var vDay=1;
var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
var vOnLastDay=0;
var vCode = "";

/*
Día para el primer mes/año requerido
Poner el número necesario de blancos antes del primer día
El siguiente 'for' controla los espacios necesarios antes del 1º día del mes
*/
vCode = vCode + "<tr>";
for (i=0; i<vFirstDay; i++) {
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + ";" + this.write_weekend_string(i) + "\"> </td>";
}

// Resto de la primera semana
for (j=vFirstDay; j<7; j++) {
mesecito=this.gMonth+1;
anyto=this.gYear;
p=p_item;
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + ";" + this.write_weekend_string(j) + "\">" +
"<a href='javascript:oculCalen(" + vDay + "," + mesecito + "," + anyto + ",\"" + p + "\");' " +
"onmouseover=\"window.status='Cambiar la fecha a: " + this.format_data(vDay) + "'; return true;\" " +
"onmouseout=\"window.status=''; return true;\" " +
"onclick=\"ggPosX=50;ggPosY=50;nd();nd();\">" +
this.format_day(vDay) +
"</a>" +
"</td>";
vDay=vDay + 1;
}
vCode = vCode + "</tr>";

// Resto de las semanas
for (k=2; k<7; k++) {
vCode = vCode + "<tr>";

for (j=0; j<7; j++) {
mesecito=this.gMonth+1;
anyto=this.gYear;
p=p_item;
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + ";" + this.write_weekend_string(j) + "\">" +
"<a href='javascript:oculCalen(" + vDay + "," + mesecito + "," + anyto + ",\"" + p + "\");' " +
"onmouseover=\"window.status='Cambiar la fecha a: " + this.format_data(vDay) + "'; return true;\" " +
"onmouseout=\"window.status=''; return true;\" " +
"onclick=\"window.scroll(0,ggPosY);ggPosX=50;ggPos Y=50;nd();nd();\">" +
this.format_day(vDay) +
"</a>" +
"</td>";
vDay=vDay + 1;

if (vDay > vLastDay) {
vOnLastDay = 1;
break;
}
}

if (j == 6)
vCode = vCode + "</tr>";
if (vOnLastDay == 1)
break;
}

// RELLENANDO ESPACIOS PARA EL RESTO DE LA ÚLTIMA SEMANA
for (m=1; m<(7-j); m++) {
if (this.gYearly)
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + "; color:grey;" + this.write_weekend_string(j+m) + "\"> </td>";
else
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + "; color:grey;" + this.write_weekend_string(j+m) + "\"></td>";
}// FIN DE RELLENANDO ESPACIOS PARA EL RESTO DE LA ÚLTIMA SEMANA

return vCode;
}

(Fin de la 3ª parte - Sigue en la 4ª)
  #4 (permalink)  
Antiguo 26/10/2005, 06:04
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 4ª parte

// ESTABLECIENDO COLOR DE FONDO PARA LAS CASILLAS DE LOS DÍAS DE FIN DE SEMANA
Calendar.prototype.write_weekend_string = function(vday) {
var i;

// Formato especial de vuelta para el fin de semana
for (i=0; i<weekend.length; i++) {
if (vday == weekend[i])
return (" background-color:" + weekendColor + ";");
}

return "";
}// FIN DE ESTABLECIENDO COLOR DE FONDO PARA LAS CASILLAS DE LOS DÍAS DE FIN DE SEMANA

Calendar.prototype.format_data = function(p_day) {
var vData;
var vMonth = 1 + this.gMonth;
vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUppe rCase();
var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
var vY4 = new String(this.gYear);
var vY2 = new String(this.gYear.substr(2,2));
var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;

switch (this.gFormat) {
case "MM\/DD\/YYYY" :
vData = vMonth + "\/" + vDD + "\/" + vY4;
break;
case "MM\/DD\/YY" :
vData = vMonth + "\/" + vDD + "\/" + vY2;
break;
case "MM-DD-YYYY" :
vData = vMonth + "-" + vDD + "-" + vY4;
break;
case "YYYY-MM-DD" :
vData = vY4 + "-" + vMonth + "-" + vDD;
break;
//case PARA EL FORMATO p_format YYYY/MM/DD
case "YYYY/MM/DD" :
vData = vDD + "/" + vMonth + "/" + vY4;
break;
case "MM-DD-YY" :
vData = vMonth + "-" + vDD + "-" + vY2;
break;
case "DD\/MON\/YYYY" :
vData = vDD + "\/" + vMon + "\/" + vY4;
break;
case "DD\/MON\/YY" :
vData = vDD + "\/" + vMon + "\/" + vY2;
break;
case "DD-MON-YYYY" :
vData = vDD + "-" + vMon + "-" + vY4;
break;
case "DD-MON-YY" :
vData = vDD + "-" + vMon + "-" + vY2;
break;
case "DD\/MONTH\/YYYY" :
vData = vDD + "\/" + vFMon + "\/" + vY4;
break;
case "DD\/MONTH\/YY" :
vData = vDD + "\/" + vFMon + "\/" + vY2;
break;
case "DD-MONTH-YYYY" :
vData = vDD + "-" + vFMon + "-" + vY4;
break;
case "DD-MONTH-YY" :
vData = vDD + "-" + vFMon + "-" + vY2;
break;
case "DD\/MM\/YYYY" :
vData = vDD + "\/" + vMonth + "\/" + vY4;
break;
case "DD\/MM\/YY" :
vData = vDD + "\/" + vMonth + "\/" + vY2;
break;
case "DD-MM-YYYY" :
vData = vDD + "-" + vMonth + "-" + vY4;
break;
case "DD-MM-YY" :
vData = vDD + "-" + vMonth + "-" + vY2;
break;
default :
vData = vMonth + "\/" + vDD + "\/" + vY4;
}

return vData;
}

function Build(p_item, p_month, p_year, p_format) {
gCal = new Calendar(p_item, p_month, p_year, p_format);

// Modificar estilo del calendario
gCal.gBGColor="white";
gCal.gLinkColor="black";
gCal.gTextColor="black";
gCal.gHeaderColor="e0eafc";

// Inicializar el array de contenidos
ggWinContent = "";

// elegir la función de mostrar correcta
if (gCal.gYearly) {
// para IE6
if (ggPosX == 50) ggPosX = 10;
if (ggPosY == 50) ggPosY = 10;
if (fontsize == 8) fontsize = 6;
// generar el calendario
gCal.showY();
}
else {
gCal.show();
}
// si éste es el primer popup del calendario
if (ggPosX == 50 && ggPosY == 50) {
overlib(ggWinContent, AUTOSTATUSCAP, STICKY, CLOSECLICK, CSSSTYLE, TEXTSIZEUNIT, "pt", TEXTSIZE, 8, CAPTIONSIZEUNIT, "pt", CAPTIONSIZE, 8, CLOSESIZEUNIT, "pt", CLOSESIZE, 8, CAPTION, "Selecciona una fecha", OFFSETX, ggPosX, OFFSETY, ggPosY);
// aparecer donce acabó. En el mismo sitio si el usuario cliquea uno de los links de año o mes
if ( (ns4) || (ie4) ) {
ggPosX = parseInt(over.left);
ggPosY = parseInt(over.top);
} else if (ns6) {
ggPosX = parseInt(over.style.left);
ggPosY = parseInt(over.style.top);
}
}
else {
// tenemos la posición guardada, se usa aquí
overlib(ggWinContent, AUTOSTATUSCAP, STICKY, CLOSECLICK, CSSSTYLE, TEXTSIZEUNIT, "pt", TEXTSIZE, 8, CAPTIONSIZEUNIT, "pt", CAPTIONSIZE, 8, CLOSESIZEUNIT, "pt", CLOSESIZE, 8, CAPTION, "Selecciona una fecha", FIXX, ggPosX, FIXY, ggPosY);
}
window.scroll(ggPosX, ggPosY);
}

function show_calendar(identif) {
p_item = identif;
if (arguments[1] == null)
p_month = new String(gNow.getMonth());
else
p_month = arguments[1];
if (arguments[2] == "" || arguments[2] == null)
p_year = new String(gNow.getFullYear().toString());
else
p_year = arguments[2];
if (arguments[3] == null)
//p_format = "YYYY-MM-DD";
//FORMATO PREDETERMINADO DE LA FECHA EN EL onmouseover
//CAMBIAR EL case DE LA
p_format = "YYYY/MM/DD";
else
p_format = arguments[3];
Build(p_item, p_month, p_year, p_format);
}
//-->
</script>

(Fin de la 4ª parte - Sigue en la 5ª parte)
  #5 (permalink)  
Antiguo 26/10/2005, 06:05
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 6ª parte

<script language="javascript" src="../css_js/overlib_mini.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript">
<!--

// LA CAPA 'overDiv' ES LA REFERIDA AL CALENDARIO
function oculCalen(dia,mes,anyo) {
if (dia<10){
dia="0"+dia;
}
if (mes<10){
mes="0"+mes;
}
document.getElementById("overDiv").style.visibilit y = "hidden";
// PASANDO EL GÉNERO RECIÉN MANDADO
document.form_prueba_Calendar_2.elDia.value = dia;
document.form_prueba_Calendar_2.elMes.value = mes;
document.form_prueba_Calendar_2.elAnio.value = anyo;
//document.adm_insPeli.peli_lanzam.focus();
}

function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}

function AbrirDialogo() {
window.open("eguraldi_c.apl","OpenWindow","width=8 00,height=400,scrollbars=no");
}

function Enviar(variable) {
var oky;
document.form_prueba_Calendar_2.Fecha.value=((docu ment.form_prueba_Calendar_2.dia.selectedIndex + 1) + "/" + (document.form_prueba_Calendar_2.mes.selectedIndex + 1) + "/" + (document.form_prueba_Calendar_2.anyo.selectedInde x + 1999));
oky=comprobarfecha();
if (oky==true) {
alert("Fecha correcta");
document.form_prueba_Calendar_2.action="prueba_Cal endar_Fin.asp";
}
else {
alert("Debe generar una fecha correcta");
document.form_prueba_Calendar_2.action="prueba_Cal endar_Fin.asp";
}
}

function comprobarfecha() {
var opcion;
comprobarfecha=true;
// SI SE ELIGE, COMO MES, Abril,Junio,Septiembre ó Noviembre (Meses de 30 días)
if ((document.form_prueba_Calendar_2.mes.selectedInde x==3) || (document.form_prueba_Calendar_2.mes.selectedIndex ==5) || (document.form_prueba_Calendar_2.mes.selectedIndex ==8) || (document.form_prueba_Calendar_2.mes.selectedIndex ==10)) {
if (document.form_prueba_Calendar_2.dia.selectedIndex > 29) {
alert ("Fecha Incorrecta. Ha elegido un mes de 30 días.");
comprobarfecha=false;
}
}
if (document.form_prueba_Calendar_2.mes.selectedIndex ==1) {
//opcion=(document.form_prueba_Calendar_2.anyo.selec tedIndex + 1 % 4);
//alert(document.form_prueba_Calendar_2.mes.selected Index);
/* opcion=document.form_prueba_Calendar_2.anyo.select edIndex; */
/* if (opcion==5) { */
opcion=document.form_prueba_Calendar_2.anyo.value;
if (opcion/4==0) { //LOS AÑOS MÚLTIPLOS DE 4 SON BISIESTOS
if (document.form_prueba_Calendar_2.dia.selectedIndex > 28){
alert ("Fecha Incorrecta. Ha elegido febrero en un año bisiesto. No puede tener más de 29 días.");
comprobarfecha=false;
}
}
else {
if (document.form_prueba_Calendar_2.dia.selectedIndex > 27){
alert ("Fecha Incorrecta. Ha elegido febrero en un año no bisiesto. No puede tener más de 28 días.");
comprobarfecha=false;
}
}
}
return(comprobarfecha);
}
//-->
</script>

<!-- <script language="vbscript" type="text/vbscript">
Sub CambiaEstacion(CodEsta, NomEsta)
FORM_CENTRAL.CODIGO_ESTACION.value = CodEsta
FORM_CENTRAL.NOMBRE_ESTACION.value = NomEsta
FORM_CENTRAL.PAGINA_DESTINO.value = ""
FORM_CENTRAL.submit
End Sub
</script> -->
<script language="javascript" src="../css_js/jsbasico.js" type="text/javascript"></script>
</head>

<body>
<%

Dim elDia, elMes, elAnio
If (Request.Form("elDia") <> "") Then
'if (Request.Form("elDia") < 10) then
'elDia = "0" & Request.Form("elDia")
'else
elDia = Request.Form("elDia")
'end if
Else
elDia = ""
End If
If (Request.Form("elMes") <> "") Then
'if (Request.Form("elMes") < 10) then
'elMes = "0" & Request.Form("elMes")
'else
elMes = Request.Form("elMes")
'end if
Else
elMes = ""
End If
elAnio = Request.Form("elAnio")
'elDia = 31
'elMes = 12
'elAnio = 2004

%>
<br />
<%=elDia%>
<br />
<%=elMes%>
<br />
<%=elAnio%>
<br />
<form action="prueba_Calendar_Fin.asp" method="post" name="form_prueba_Calendar_2" id="form_prueba_Calendar_2">
<script>
<!--
var saltoLin = "<br />";
elDia = "<%=elDia%>";
elMes = "<%=elMes%>";
elAnio = "<%=elAnio%>";

if (elDia=="" && elMes=="" && elAnio==""){
var Hoy = new Date(); // Captura la fecha actual

// Extrae el año, el mes y el día.
elAnio = Hoy.getFullYear();
elMes = Hoy.getMonth()+1;
if (elMes < 10){
elMes = "0" + elMes;
}
elDia = Hoy.getDate();
if (elDia < 10){
elDia = "0" + elDia;
}
}

document.write("<select name=\"elDia\">");
var unDia, unMes, unAnio;
for(unDia = 1; unDia <= 31; unDia++) { // BUCLE de DÍAS.
/**/if (unDia < 10){
unDia = "0"+ unDia;
}
if (unDia == elDia){
document.write("<option selected=\"selected\" value=\""+unDia+"\">"+unDia+"</option>");
} else {
document.write("<option value=\""+unDia+"\">"+unDia+"</option>");
}
}
document.write("</select>");
document.write(" / ");
document.write("<select name=\"elMes\">");
for(unMes = 1; unMes <= 12; unMes++) { // BUCLE de MESES.
if (unMes < 10){
unMes = "0"+ unMes;
}/**/
if (unMes == elMes){
document.write("<option selected=\"selected\" value=\""+unMes+"\">"+unMes+"</option>");
} else {
document.write("<option value=\""+unMes+"\">"+unMes+"</option>");
}
}
document.write("</select>");
document.write(" / ");
document.write("<select name=\"elAnio\">");

var anioIni = parseInt(elAnio)-5;
var anioTope = parseInt(elAnio)+5;

for(unAnio = anioIni; unAnio <= anioTope; unAnio++) { // BUCLE de AÑOS.
if (unAnio == elAnio){
document.write("<option selected=\"selected\" value=\""+unAnio+"\">"+unAnio+"</option>");
} else {
document.write("<option value=\""+unAnio+"\">"+unAnio+"</option>");
}
}
document.write("</select>");
//-->
</script>
<input name="" type="submit" value="Enviar" />
<a href="javascript:show_calendar('FORM_CENTRAL.dia') ;" onmouseover="calen.src='../imags/calen_on.gif';"
onmouseout="calen.src='../imags/calen_off.gif';" title="Ver Calendario"><img src="../imags/calen_off.gif" name="calen" width="14" height="14" border="0" /></a>
<div id="overDiv" style="z-index: 1000; visibility: hidden; position: absolute;"></div>
</form>
</body>
</html>

================================================== ========
FIN de 'prueba_Calendar_Fin.asp'


(Fin de la 5ª parte - Sigue en la 6ª)
  #6 (permalink)  
Antiguo 26/10/2005, 06:08
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 7ª parte

INICIO de 'overlib_mini.js'
================================================== ========

//\//////////////////////////////////////////////////////////////////////////////////
//\ overLIB 3.50 -- This notice must remain untouched at all times.
//\ Copyright Erik Bosrup 1998-2001. All rights reserved.
//\ THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL!
var INARRAY=1;
var CAPARRAY=2;
var STICKY=3;
var BACKGROUND=4;
var NOCLOSE=5;
var CAPTION=6;
var LEFT=7;
var RIGHT=8;
var CENTER=9;
var OFFSETX=10;
var OFFSETY=11;
var FGCOLOR=12;
var BGCOLOR=13;
var TEXTCOLOR=14;
var CAPCOLOR=15;
var CLOSECOLOR=16;
var WIDTH=17;
var BORDER=18;
var STATUS=19;
var AUTOSTATUS=20;
var AUTOSTATUSCAP=21;
var HEIGHT=22;
var CLOSETEXT=23;
var SNAPX=24;
var SNAPY=25;
var FIXX=26;
var FIXY=27;
var FGBACKGROUND=28;
var BGBACKGROUND=29;
var PADX=30;// PADX2 out
var PADY=31;// PADY2 out
var FULLHTML=34;
var ABOVE=35;
var BELOW=36;
var CAPICON=37;
var TEXTFONT=38;
var CAPTIONFONT=39;
var CLOSEFONT=40;
var TEXTSIZE=41;
var CAPTIONSIZE=42;
var CLOSESIZE=43;
var FRAME=44;
var TIMEOUT=45;
var FUNCTION=46;
var DELAY=47;
var HAUTO=48;
var VAUTO=49;
var CLOSECLICK=50;
var CSSOFF=51;
var CSSSTYLE=52;
var CSSCLASS=53;
var FGCLASS=54;
var BGCLASS=55;
var TEXTFONTCLASS=56;
var CAPTIONFONTCLASS=57;
var CLOSEFONTCLASS=58;
var PADUNIT=59;
var HEIGHTUNIT=60;
var WIDTHUNIT=61;
var TEXTSIZEUNIT=62;
var TEXTDECORATION=63;
var TEXTSTYLE=64;
var TEXTWEIGHT=65;
var CAPTIONSIZEUNIT=66;
var CAPTIONDECORATION=67;
var CAPTIONSTYLE=68;
var CAPTIONWEIGHT=69;
var CLOSESIZEUNIT=70;
var CLOSEDECORATION=71;
var CLOSESTYLE=72;
var CLOSEWEIGHT=73;
if(typeof ol_fgcolor=='undefined'){var ol_fgcolor="#9CBDF3";}
if(typeof ol_bgcolor=='undefined'){var ol_bgcolor="#204368";}
if(typeof ol_textcolor=='undefined'){var ol_textcolor="#204368";}
if(typeof ol_capcolor=='undefined'){var ol_capcolor="#FFFFFF";}
if(typeof ol_closecolor=='undefined'){var ol_closecolor="#E0EAFC";}
if(typeof ol_textfont=='undefined'){var ol_textfont="Arial, Helvetica, sans-serif";}
if(typeof ol_captionfont=='undefined'){var ol_captionfont="Arial, Helvetica, sans-serif";}
if(typeof ol_closefont=='undefined'){var ol_closefont="Arial, Helvetica, sans-serif";}
if(typeof ol_textsize=='undefined'){var ol_textsize="1";}
if(typeof ol_captionsize=='undefined'){var ol_captionsize="1";}
if(typeof ol_closesize=='undefined'){var ol_closesize="1";}
if(typeof ol_width=='undefined'){var ol_width="200";}
if(typeof ol_border=='undefined'){var ol_border="1";}
if(typeof ol_offsetx=='undefined'){var ol_offsetx=10;}
if(typeof ol_offsety=='undefined'){var ol_offsety=10;}
if(typeof ol_text=='undefined'){var ol_text="Default Text";}
if(typeof ol_cap=='undefined'){var ol_cap="";}
if(typeof ol_sticky=='undefined'){var ol_sticky=0;}
if(typeof ol_background=='undefined'){var ol_background="";}
if(typeof ol_close=='undefined'){var ol_close="Cerrar";}
if(typeof ol_hpos=='undefined'){var ol_hpos=8;}
if(typeof ol_status=='undefined'){var ol_status="";}
if(typeof ol_autostatus=='undefined'){var ol_autostatus=0;}
if(typeof ol_height=='undefined'){var ol_height=-1;}
if(typeof ol_snapx=='undefined'){var ol_snapx=0;}
if(typeof ol_snapy=='undefined'){var ol_snapy=0;}
if(typeof ol_fixx=='undefined'){var ol_fixx=-1;}
if(typeof ol_fixy=='undefined'){var ol_fixy=-1;}
if(typeof ol_fgbackground=='undefined'){var ol_fgbackground="";}
if(typeof ol_bgbackground=='undefined'){var ol_bgbackground="";}
if(typeof ol_padxl=='undefined'){var ol_padxl=1;}
if(typeof ol_padxr=='undefined'){var ol_padxr=1;}
if(typeof ol_padyt=='undefined'){var ol_padyt=1;}
if(typeof ol_padyb=='undefined'){var ol_padyb=1;}
if(typeof ol_fullhtml=='undefined'){var ol_fullhtml=0;}
if(typeof ol_vpos=='undefined'){var ol_vpos=36;}
if(typeof ol_aboveheight=='undefined'){var ol_aboveheight=0;}
if(typeof ol_caption=='undefined'){var ol_capicon="";}
if(typeof ol_frame=='undefined'){var ol_frame=self;}
if(typeof ol_timeout=='undefined'){var ol_timeout=0;}
if(typeof ol_function=='undefined'){var ol_function=Function();}
if(typeof ol_delay=='undefined'){var ol_delay=0;}
if(typeof ol_hauto=='undefined'){var ol_hauto=0;}
if(typeof ol_vauto=='undefined'){var ol_vauto=0;}
if(typeof ol_closeclick=='undefined'){var ol_closeclick=0;}
if(typeof ol_css=='undefined'){var ol_css=51;}
if(typeof ol_fgclass=='undefined'){var ol_fgclass="";}
if(typeof ol_bgclass=='undefined'){var ol_bgclass="";}
if(typeof ol_textfontclass=='undefined'){var ol_textfontclass="";}
if(typeof ol_captionfontclass=='undefined'){var ol_captionfontclass="";}
if(typeof ol_closefontclass=='undefined'){var ol_closefontclass="";}
if(typeof ol_padunit=='undefined'){var ol_padunit="px";}
if(typeof ol_heightunit=='undefined'){var ol_heightunit="px";}
if(typeof ol_widthunit=='undefined'){var ol_widthunit="px";}
if(typeof ol_textsizeunit=='undefined'){var ol_textsizeunit="px";}
if(typeof ol_textdecoration=='undefined'){var ol_textdecoration="none";}
if(typeof ol_textstyle=='undefined'){var ol_textstyle="normal";}
if(typeof ol_textweight=='undefined'){var ol_textweight="normal";}
if(typeof ol_captionsizeunit=='undefined'){var ol_captionsizeunit="px";}
if(typeof ol_captiondecoration=='undefined'){var ol_captiondecoration="none";}
if(typeof ol_captionstyle=='undefined'){var ol_captionstyle="normal";}
if(typeof ol_captionweight=='undefined'){var ol_captionweight="bold";}
if(typeof ol_closesizeunit=='undefined'){var ol_closesizeunit="px";}
if(typeof ol_closedecoration=='undefined'){var ol_closedecoration="none";}
if(typeof ol_closestyle=='undefined'){var ol_closestyle="normal";}
if(typeof ol_closeweight=='undefined'){var ol_closeweight="normal";}
if(typeof ol_texts=='undefined'){var ol_texts=new Array("Text 0", "Text 1");}
if(typeof ol_caps=='undefined'){var ol_caps=new Array("Caption 0", "Caption 1");}
var otext="";
var ocap="";
var osticky=0;
var obackground="";
var oclose="Close";
var ohpos=8;
var ooffsetx=2;
var ooffsety=2;
var ofgcolor="";
var obgcolor="";
var otextcolor="";
var ocapcolor="";
var oclosecolor="";
var owidth=100;
var oborder=1;
var ostatus="";
var oautostatus=0;
var oheight=-1;
var osnapx=0;
var osnapy=0;
var ofixx=-1;
var ofixy=-1;
var ofgbackground="";
var obgbackground="";
var opadxl=0;
var opadxr=0;
var opadyt=0;
var opadyb=0;
var ofullhtml=0;
var ovpos=36;
var oaboveheight=0;
var ocapicon="";
var otextfont="Arial, Helvetica, sans-serif";
var ocaptionfont="Arial, Helvetica, sans-serif";
var oclosefont="Arial, Helvetica, sans-serif";
var otextsize="1";
var ocaptionsize="1";
var oclosesize="1";
var oframe=self;
var otimeout=0;
var otimerid=0;
var oallowmove=0;
var ofunction=Function();
var odelay=0;
var odelayid=0;
var ohauto=0;
var ovauto=0;
var ocloseclick=0;
var ocss=51;
var ofgclass="";
var obgclass="";
var otextfontclass="";
var ocaptionfontclass="";
var oclosefontclass="";
var opadunit="px";
var oheightunit="px";
var owidthunit="px";
var otextsizeunit="px";
var otextdecoration="";
var otextstyle="";
var otextweight="";
var ocaptionsizeunit="px";
var ocaptiondecoration="";
var ocaptionstyle="";
var ocaptionweight="";
var oclosesizeunit="px";
var oclosedecoration="";
var oclosestyle="";
var ocloseweight="";
var ox=0;
var oy=0;
var oallow=0;
var oshowingsticky=0;
var oremovecounter=0;
var over=null;
var ns4=(document.layers)? true:false;
var ns6=(document.getElementById)? true:false;
var ie4=(document.all)? true:false;
var ie5=false;
if(ie4){
if((navigator.userAgent.indexOf('MSIE 5')> 0)||(navigator.userAgent.indexOf('MSIE 6')> 0)){
ie5=true;
}
if(ns6){
ns6=false;
}
}
if((ns4)||(ie4)||(ns6)){
document.onmousemove=mouseMove
if(ns4)document.captureEvents(Event.MOUSEMOVE)
}else{
overlib=no_overlib;
nd=no_overlib;
ver3fix=true;
}
function no_overlib(){
return ver3fix;
}
function overlib(){
otext=ol_text;
ocap=ol_cap;
osticky=ol_sticky;
obackground=ol_background;
oclose=ol_close;
ohpos=ol_hpos;
ooffsetx=ol_offsetx;
ooffsety=ol_offsety;
ofgcolor=ol_fgcolor;
obgcolor=ol_bgcolor;
otextcolor=ol_textcolor;
ocapcolor=ol_capcolor;
oclosecolor=ol_closecolor;
owidth=ol_width;
oborder=ol_border;
ostatus=ol_status;
oautostatus=ol_autostatus;
oheight=ol_height;
osnapx=ol_snapx;
osnapy=ol_snapy;
ofixx=ol_fixx;
ofixy=ol_fixy;
ofgbackground=ol_fgbackground;
obgbackground=ol_bgbackground;
opadxl=ol_padxl;
opadxr=ol_padxr;
opadyt=ol_padyt;
opadyb=ol_padyb;
ofullhtml=ol_fullhtml;
ovpos=ol_vpos;
oaboveheight=ol_aboveheight;
ocapicon=ol_capicon;
otextfont=ol_textfont;
ocaptionfont=ol_captionfont;
oclosefont=ol_closefont;
otextsize=ol_textsize;
ocaptionsize=ol_captionsize;
oclosesize=ol_closesize;
otimeout=ol_timeout;
ofunction=ol_function;
odelay=ol_delay;
ohauto=ol_hauto;
ovauto=ol_vauto;
ocloseclick=ol_closeclick;
ocss=ol_css;
ofgclass=ol_fgclass;
obgclass=ol_bgclass;
otextfontclass=ol_textfontclass;
ocaptionfontclass=ol_captionfontclass;
oclosefontclass=ol_closefontclass;
opadunit=ol_padunit;
oheightunit=ol_heightunit;
owidthunit=ol_widthunit;
otextsizeunit=ol_textsizeunit;
otextdecoration=ol_textdecoration;
otextstyle=ol_textstyle;
otextweight=ol_textweight;
ocaptionsizeunit=ol_captionsizeunit;
ocaptiondecoration=ol_captiondecoration;
ocaptionstyle=ol_captionstyle;
ocaptionweight=ol_captionweight;
oclosesizeunit=ol_closesizeunit;
oclosedecoration=ol_closedecoration;
oclosestyle=ol_closestyle;
ocloseweight=ol_closeweight;
if((ns4)||(ie4)||(ns6)){
oframe=ol_frame;
if(ns4)over=oframe.document.overDiv
if(ie4)over=oframe.overDiv.style
if(ns6)over=oframe.document.getElementById("overDi v");
}

(Fin de la 6ª parte - Sigue en la 7ª)
  #7 (permalink)  
Antiguo 26/10/2005, 06:10
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 8ª parte

var c=-1;
var ar=arguments;
for(i=0;i < ar.length;i++){
if(c < 0){
if(ar[i]==1){
otext=ol_texts[ar[++i]];
}else{
otext=ar[i];
}
c=0;
}else{
if(ar[i]==1){otext=ol_texts[ar[++i]];continue;}
if(ar[i]==2){ocap=ol_caps[ar[++i]];continue;}
if(ar[i]==3){osticky=1;continue;}
if(ar[i]==4){obackground=ar[++i];continue;}
if(ar[i]==NOCLOSE){oclose="";continue;}
if(ar[i]==6){ocap=ar[++i];continue;}
if(ar[i]==9 || ar[i]==7 || ar[i]==8){ohpos=ar[i];continue;}
if(ar[i]==10){ooffsetx=ar[++i];continue;}
if(ar[i]==11){ooffsety=ar[++i];continue;}
if(ar[i]==12){ofgcolor=ar[++i];continue;}
if(ar[i]==13){obgcolor=ar[++i];continue;}
if(ar[i]==14){otextcolor=ar[++i];continue;}
if(ar[i]==15){ocapcolor=ar[++i];continue;}
if(ar[i]==16){oclosecolor=ar[++i];continue;}
if(ar[i]==17){owidth=ar[++i];continue;}
if(ar[i]==18){oborder=ar[++i];continue;}
if(ar[i]==19){ostatus=ar[++i];continue;}
if(ar[i]==20){oautostatus=1;continue;}
if(ar[i]==21){oautostatus=2;continue;}
if(ar[i]==22){oheight=ar[++i];oaboveheight=ar[i];continue;}// Same param again.
if(ar[i]==23){oclose=ar[++i];continue;}
if(ar[i]==24){osnapx=ar[++i];continue;}
if(ar[i]==25){osnapy=ar[++i];continue;}
if(ar[i]==26){ofixx=ar[++i];continue;}
if(ar[i]==27){ofixy=ar[++i];continue;}
if(ar[i]==28){ofgbackground=ar[++i];continue;}
if(ar[i]==29){obgbackground=ar[++i];continue;}
if(ar[i]==30){opadxl=ar[++i];opadxr=ar[++i];continue;}
if(ar[i]==31){opadyt=ar[++i];opadyb=ar[++i];continue;}
if(ar[i]==34){ofullhtml=1;continue;}
if(ar[i]==36 || ar[i]==35){ovpos=ar[i];continue;}
if(ar[i]==37){ocapicon=ar[++i];continue;}
if(ar[i]==38){otextfont=ar[++i];continue;}
if(ar[i]==39){ocaptionfont=ar[++i];continue;}
if(ar[i]==40){oclosefont=ar[++i];continue;}
if(ar[i]==41){otextsize=ar[++i];continue;}
if(ar[i]==42){ocaptionsize=ar[++i];continue;}
if(ar[i]==43){oclosesize=ar[++i];continue;}
if(ar[i]==44){opt_FRAME(ar[++i]);continue;}
if(ar[i]==45){otimeout=ar[++i];continue;}
if(ar[i]==46){opt_FUNCTION(ar[++i]);continue;}
if(ar[i]==47){odelay=ar[++i];continue;}
if(ar[i]==48){ohauto=(ohauto==0)? 1 : 0;continue;}
if(ar[i]==49){ovauto=(ovauto==0)? 1 : 0;continue;}
if(ar[i]==50){ocloseclick=(ocloseclick==0)? 1 : 0;continue;}
if(ar[i]==51){ocss=ar[i];continue;}
if(ar[i]==52){ocss=ar[i];continue;}
if(ar[i]==53){ocss=ar[i];continue;}
if(ar[i]==54){ofgclass=ar[++i];continue;}
if(ar[i]==55){obgclass=ar[++i];continue;}
if(ar[i]==56){otextfontclass=ar[++i];continue;}
if(ar[i]==57){ocaptionfontclass=ar[++i];continue;}
if(ar[i]==58){oclosefontclass=ar[++i];continue;}
if(ar[i]==59){opadunit=ar[++i];continue;}
if(ar[i]==60){oheightunit=ar[++i];continue;}
if(ar[i]==61){owidthunit=ar[++i];continue;}
if(ar[i]==62){otextsizeunit=ar[++i];continue;}
if(ar[i]==63){otextdecoration=ar[++i];continue;}
if(ar[i]==64){otextstyle=ar[++i];continue;}
if(ar[i]==65){otextweight=ar[++i];continue;}
if(ar[i]==66){ocaptionsizeunit=ar[++i];continue;}
if(ar[i]==67){ocaptiondecoration=ar[++i];continue;}
if(ar[i]==68){ocaptionstyle=ar[++i];continue;}
if(ar[i]==69){ocaptionweight=ar[++i];continue;}
if(ar[i]==70){oclosesizeunit=ar[++i];continue;}
if(ar[i]==71){oclosedecoration=ar[++i];continue;}
if(ar[i]==72){oclosestyle=ar[++i];continue;}
if(ar[i]==73){ocloseweight=ar[++i];continue;}
}
}
if(odelay==0){
return overlib350();
}else{
odelayid=setTimeout("overlib350()", odelay);
if(osticky){
return false;
}else{
return true;
}
}
}
function nd(){
if(oremovecounter >=1){oshowingsticky=0};
if((ns4)||(ie4)||(ns6)){
if(oshowingsticky==0){
oallowmove=0;
if(over !=null)hideObject(over);
}else{
oremovecounter++;
}
}
return true;
}
function overlib350(){
var layerhtml;
if(obackground !="" || ofullhtml){
layerhtml=ol_content_background(otext, obackground, ofullhtml);
}else{
if(ofgbackground !="" && ocss==CSSOFF){
ofgbackground="background=\""+ofgbackground+"\"";
}
if(obgbackground !="" && ocss==CSSOFF){
obgbackground="background=\""+obgbackground+"\"";
}
if(ofgcolor !="" && ocss==CSSOFF){
ofgcolor="bgcolor=\""+ofgcolor+"\"";
}
if(obgcolor !="" && ocss==CSSOFF){
obgcolor="bgcolor=\""+obgcolor+"\"";
}
if(oheight > 0 && ocss==51){
oheight="height=" + oheight;
}else{
oheight="";
}
if(ocap==""){
layerhtml=ol_content_simple(otext);
}else{
if(osticky){
layerhtml=ol_content_caption(otext, ocap, oclose);
}else{
layerhtml=ol_content_caption(otext, ocap, "");
}
}
}
if(osticky){
oshowingsticky=1;
oremovecounter=0;
}
layerWrite(layerhtml);
if(oautostatus > 0){
ostatus=otext;
if(oautostatus > 1){
ostatus=ocap;
}
}
oallowmove=0;
if(otimeout > 0){
if(otimerid > 0)clearTimeout(otimerid);
otimerid=setTimeout("cClick()", otimeout);
}
disp(ostatus);
if(osticky){
oallowmove=0;
return false;
}else{
return true;
}
}


(Fin de la 8ª parte - sigue en la 9ª)
  #8 (permalink)  
Antiguo 26/10/2005, 06:11
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 9ª parte

function ol_content_caption(text, title, close){
closing="";
closeevent="onmouseover";
if(ocloseclick==1)closeevent="onclick";
if(ocapicon !="")ocapicon="<img src=\""+ocapicon+"\"> ";
if(close !=""){
if(ocss==CSSCLASS)closing="<td style=\"text-align:right;\"><a href=\"/\" "+closeevent+"=\"return cClick();\" class=\""+oclosefontclass+"\">"+close+"</a></td>";
if(ocss==CSSSTYLE)closing="<td style=\"text-align:right;\"><a href=\"/\" "+closeevent+"=\"return cClick();\" style=\"color: "+oclosecolor+";font-family: "+oclosefont+";font-size: "+oclosesize+oclosesizeunit+";text-decoration: "+oclosedecoration+";font-weight: "+ocloseweight+";font-style:"+oclosestyle+";\">"+close+"</a></td>";
if(ocss==CSSOFF)closing="<td style=\"text-align:right;\"><a href=\"/\" "+closeevent+"=\"return cClick();\" style=\"color: "+oclosecolor+";font-family: "+oclosefont+";font-size: "+oclosesize+oclosesizeunit+";\">"+close+"</a></td>";
}
if(ocss==CSSCLASS)txt="<table width="+owidth+" border=\"0\" cellpadding=\""+oborder+"\" cellspacing=\"0\" class=\""+obgclass+"\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><span class=\""+ocaptionfontclass+"\">"+ocapicon+title+" </span></td>"+closing+"</tr></table><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" class=\""+ofgclass+"\"><tr><td style=\"vertical-align:top;\"><span class=\""+otextfontclass+"\">"+text+"</span></td></tr></table></td></tr></table>";
if(ocss==CSSSTYLE)txt="<table width=\""+owidth+"\" border=\"0\" cellpadding=\""+oborder+"\" cellspacing=\"0\" style=\"background-color: "+obgcolor+";background-image: url("+obgbackground+");height: "+oheight+oheightunit+";\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td style=\"font-family: "+ocaptionfont+";color: "+ocapcolor+";font-size: "+ocaptionsize+ocaptionsizeunit+";font-weight: "+ocaptionweight+";font-style: "+ocaptionstyle+";\">"+ocapicon+title+"</td>"+closing+"</tr></table><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"color: "+ofgcolor+";background-color: "+ofgcolor+";height: "+oheight+oheightunit+";\"><tr><td style=\"vertical-align:top; font-family: "+otextfont+";color: "+otextcolor+";font-size: "+otextsize+otextsizeunit+";text-decoration: "+otextdecoration+";font-weight: "+otextweight+";font-style:"+otextstyle+"\">"+text+"</td></tr></table></td></tr></table>";
if(ocss==CSSOFF)txt="<table width=\""+owidth+"\" border=\"0\" cellpadding=\""+oborder+"\" cellspacing=\"0\" "+obgcolor+" "+obgbackground+" "+oheight+"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td style=\font-weight:bold; color:"+ocapcolor+"; font-family:"+ocaptionfont+"; font-size:"+ocaptionsize+";\">"+ocapicon+title+"</td>"+closing+"</tr></table><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" "+ofgcolor+" "+ofgbackground+" "+oheight+"><tr><td style=\"vertical-align:top; color:"+otextcolor+"; font-family:"+otextfont+"; font-size:"+otextsize+";\">"+text+"</td></tr></table></td></tr></table>";
set_background("");
return txt;
}
function set_background(pic){
if(pic==""){
if(ie4)over.backgroundImage="none";
if(ns6)over.style.backgroundImage="none";
}else{
if(ns4){
over.background.src=pic;
}else if(ie4){
over.backgroundImage="url("+pic+")";
}else if(ns6){
over.style.backgroundImage="url("+pic+")";
}
}
}
function disp(statustext){
if((ns4)||(ie4)||(ns6)){
if(oallowmove==0){
placeLayer();
showObject(over);
oallowmove=1;
}
}
if(statustext !=""){
self.status=statustext;
}
}
function placeLayer(){
var placeX, placeY;
if(ofixx > -1){
placeX=ofixx;
}else{
winoffset=(ie4)? oframe.document.body.scrollLeft : oframe.pageXOffset;
if(ie4)iwidth=oframe.document.body.clientWidth;
if(ns4)iwidth=oframe.innerWidth;// was screwed in mozilla, fixed now?
if(ns6)iwidth=oframe.outerWidth;
if(ohauto==1){
if((ox - winoffset)>((eval(iwidth))/ 2)){
ohpos=7;
}else{
ohpos=8;
}
}
if(ohpos==9){// Center
placeX=ox+ooffsetx-(owidth/2);
}
if(ohpos==8){// Right
placeX=ox+ooffsetx;
if((eval(placeX)+ eval(owidth))>(winoffset + iwidth)){
placeX=iwidth + winoffset - owidth;
if(placeX < 0)placeX=0;
}
}
if(ohpos==7){// Left
placeX=ox-ooffsetx-owidth;
if(placeX < winoffset)placeX=winoffset;
}
if(osnapx > 1){
var snapping=placeX % osnapx;
if(ohpos==7){
placeX=placeX -(osnapx + snapping);
}else{
placeX=placeX +(osnapx - snapping);
}
if(placeX < winoffset)placeX=winoffset;
}
}
if(ofixy > -1){
placeY=ofixy;
}else{
scrolloffset=(ie4)? oframe.document.body.scrollTop : oframe.pageYOffset;
if(ovauto==1){
if(ie4)iheight=oframe.document.body.clientHeight;
if(ns4)iheight=oframe.innerHeight;
if(ns6)iheight=oframe.outerHeight;
iheight=(eval(iheight))/ 2;
if((oy - scrolloffset)> iheight){
ovpos=35;
}else{
ovpos=36;
}
}
if(ovpos==35){
if(oaboveheight==0){
var divref=(ie4)? oframe.document.all['overDiv'] : over;
oaboveheight=(ns4)? divref.clip.height : divref.offsetHeight;
}
placeY=oy -(oaboveheight + ooffsety);
if(placeY < scrolloffset)placeY=scrolloffset;
}else{
placeY=oy + ooffsety;
}
if(osnapy > 1){
var snapping=placeY % osnapy;
if(oaboveheight > 0 && ovpos==35){
placeY=placeY -(osnapy + snapping);
}else{
placeY=placeY +(osnapy - snapping);
}
if(placeY < scrolloffset)placeY=scrolloffset;
}
}
repositionTo(over, placeX, placeY);
}
function mouseMove(e){
if((ns4)||(ns6)){ox=e.pageX;oy=e.pageY;}
if(ie4){ox=event.x;oy=event.y;}
if(ie5){ox=event.x+oframe.document.body.scrollLeft ;oy=event.y+oframe.document.body.scrollTop;}
if(oallowmove==1){
placeLayer();
}
}
function cClick(){
hideObject(over);
oshowingsticky=0;
return false;
}
function compatibleframe(frameid){
if(ns4){
if(typeof frameid.document.overDiv=='undefined')return false;
}else if(ie4){
if(typeof frameid.document.all["overDiv"]=='undefined')return false;
}else if(ns6){
if(frameid.document.getElementById('overDiv')==nul l)return false;
}
return true;
}
function layerWrite(txt){
txt +="\n";
if(ns4){
var lyr=oframe.document.overDiv.document
lyr.write(txt)
lyr.close()
}else if(ie4){
oframe.document.all["overDiv"].innerHTML=txt
}else if(ns6){
range=oframe.document.createRange();
range.setStartBefore(over);
domfrag=range.createContextualFragment(txt);
while(over.hasChildNodes()){
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
}
}
function showObject(obj){
if(ns4)obj.visibility="show";
else if(ie4)obj.visibility="visible";
else if(ns6)obj.style.visibility="visible";
}
function hideObject(obj){
if(ns4)obj.visibility="hide";
else if(ie4)obj.visibility="hidden";
else if(ns6)obj.style.visibility="hidden";
if(otimerid > 0)clearTimeout(otimerid);
if(odelayid > 0)clearTimeout(odelayid);
otimerid=0;
odelayid=0;
self.status="";
}
function repositionTo(obj,xL,yL){
if((ns4)||(ie4)){
obj.left=xL;
obj.top=yL;
}else if(ns6){
obj.style.left=xL + "px";
obj.style.top=yL+ "px";
}
}
function opt_FRAME(frm){
oframe=compatibleframe(frm)? frm : ol_frame;
if((ns4)||(ie4 ||(ns6))){
if(ns4)over=oframe.document.overDiv;
if(ie4)over=oframe.overDiv.style;
if(ns6)over=oframe.document.getElementById("overDi v");
}
return 0;
}
function opt_FUNCTION(callme){
otext=callme()
return 0;
}

================================================== ========
FIN de 'overlib_mini.js'

(Fin de la 9ª parte - Sigue en la 10ª)
  #9 (permalink)  
Antiguo 26/10/2005, 06:12
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Orden de los días de la semana - 10ª parte - Fin

Estando en el código de 'prueba_Calendar_Fin.asp', en lo referente a la CABECERA de la SEMANA solamente habría que cambiar el orden de una de las líneas, pasando la referente al 'DOM' a la última posición.

El problema está a la hora de los números del mes, después de CABECERA DE LA SEMANA.

Se recogen una serie de valores que se meten en variables (Fecha, Número de Día de la Semana, PrimerDíaDelaSemana, ÚltimoDía)

A partir de ahí, se construyen las semanas del mes:
primero los espacios de la primera semana, luego el resto de la semana y después el resto de las otras semanas.

Para las dos primeras cosas, está esto:
================================================== =======

vCode = vCode + "<tr>";
for (i=0; i<vFirstDay; i++) {
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + ";" + this.write_weekend_string(i) + "\"> </td>";
}

// Resto de la primera semana
for (j=vFirstDay; j<7; j++) {
mesecito=this.gMonth+1;
anyto=this.gYear;
p=p_item;
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + ";" + this.write_weekend_string(j) + "\">" +
"<a href='javascript:oculCalen(" + vDay + "," + mesecito + "," + anyto + ",\"" + p + "\");' " +
"onmouseover=\"window.status='Cambiar la fecha a: " + this.format_data(vDay) + "'; return true;\" " +
"onmouseout=\"window.status=''; return true;\" " +
"onclick=\"ggPosX=50;ggPosY=50;nd();nd();\">" +
this.format_day(vDay) +
"</a>" +
"</td>";
vDay=vDay + 1;
}
vCode = vCode + "</tr>";

================================================== =======


Yo he hecho este cambio:
================================================== =======

vCode = vCode + "<tr>";
for (i=0; i<vFirstDay-1; i++) {
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + ";" + this.write_weekend_string(i) + "\"> </td>";
}

// Resto de la primera semana
for (j=vFirstDay-1; j<7; j++) {
mesecito=this.gMonth+1;
anyto=this.gYear;
p=p_item;
vCode = vCode + "<td width=\"14%\" style=\"font-family:" + fontface + ";" + this.write_weekend_string(j) + "\">" +
"<a href='javascript:oculCalen(" + vDay + "," + mesecito + "," + anyto + ",\"" + p + "\");' " +
"onmouseover=\"window.status='Cambiar la fecha a: " + this.format_data(vDay) + "'; return true;\" " +
"onmouseout=\"window.status=''; return true;\" " +
"onclick=\"ggPosX=50;ggPosY=50;nd();nd();\">" +
this.format_day(vDay) +
"</a>" +
"</td>";
vDay=vDay + 1;
}
vCode = vCode + "</tr>";

================================================== =======


Y en principio este cambio da la sensación que funciona bien hasta que pasas a un mes cuya primera semana empieza en DOMINGO, es decir que su primera semana sólo tiene un día.
Con los cambios que hago, no pone el 1 como Domingo, sino que lo pone en el lugar del Lunes de la segunda semana la cuál resulta con dos Domingos (es decir que esta semana queda con 8 días). El resto de la semana queda bien.

Ya está todo explicado.

¿Alguien que todavía siga en el mensaje sabría como corregir esto para que todos los meses se construyeran bien, empezando por el LUNES?

Gracias por la paciencia de llegar hasta aquí, la atención prestada y la posible y deseada ayuda.

Saludos,

zacktagnan.
================================================== =======
  #10 (permalink)  
Antiguo 26/10/2005, 08:38
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 4 meses
Puntos: 16
Pues que forma tan incomoda de poner esto, nomas de pensar tener que estar entrando a 10 diferentes post para ver este script me da flojera
  #11 (permalink)  
Antiguo 26/10/2005, 16:31
Avatar de KarlanKas
Moderador extraterrestre
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 22 años, 4 meses
Puntos: 61
En www.tunait.com tienes un calendario configurable mucho más sencillo...
__________________
Cómo escribir

No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia.
  #12 (permalink)  
Antiguo 26/10/2005, 18:36
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 4 meses
Puntos: 16
chale, tanto para nada
  #13 (permalink)  
Antiguo 27/10/2005, 03:38
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Si la cosa me salió un pelín largaaaaaaaa.

La cuestión es que puse todo dentro del mismo mensaje. Entonces el sistema me decía que era muy largo. Luego me ocurrió dividirlo por partes y poner cada una en un tema indicando que era la parte de un todo

Y cuando manda la 2ª parte, me dí cuenta que esta segunda podía haberla incluído como respuesta de la 1ª, y así sucesivamente hasta el final.
Pero como enviado por separado dos partes, para no dejarlas colgadas seguí abriendo un tema por cada parte.

========================
INCISO: Cuando insertas un tema, si luego lo desestimas ¿hay alguna forma de que el que lo ha insertado lo pueda borrar?
========================

Así que gracias al que lo ha puesto todo en uno (no sé si ha sido el propio sistema ó uno de los administradores).
Y tal como ha quedado (es decir todo en el mismo tema) es como se me ocurrió ponerlo.


Volviendo a la cuestión del Tema en sí, ¿Nadie sabe como corregir el apartado de la construcción de las semanas del mes para que el primer día sea LUNES y no DOMINGO?

Gracias de nuevo.

Saludos,

zacktagnan.
================================================== =======
  #14 (permalink)  
Antiguo 27/10/2005, 03:41
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
POSTDATA:
Si incluí todo el código necesario fue por si a otro usuario le interesase la cuestión de tener un Calendario actualizable.

Saludos,

zacktagnan.
================================================== =======
  #15 (permalink)  
Antiguo 28/10/2005, 11:03
Avatar de zacktagnan  
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años
Puntos: 3
Muchas visitas pero nadie da una solución.

¿No hay ningún experto en el tema ó no hay ganas con tanto código?

Saludos,

zacktagnan.
================================================== =======
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 09:46.