Be', posto lo stesso il codice, tutto sommato si tratta di un frame che visualizza un calendario e forse puo' tornare utile a qualcuno.
Utilizza anche codice PHP.
Il passo incriminato e' quello dove si trova il campo di input con name="G_<? echo $ctr_all; ?>"codice:<? ?> <html> <script type="text/javascript" language="JavaScript"> var Memo_Anno = ""; var Memo_Mese = ""; var Tab_Feste = new Array(); Tab_Feste[0] = "0101Capodanno"; Tab_Feste[1] = "0106Epifania"; Tab_Feste[2] = "Pasqua"; Tab_Feste[3] = "Lun. Angelo"; Tab_Feste[4] = "0425Festa Naz."; Tab_Feste[5] = "0501Festa Lav."; Tab_Feste[6] = "0602Festa Rep."; Tab_Feste[7] = "0815Assunzione"; Tab_Feste[8] = "1101Ognissanti"; Tab_Feste[9] = "1208Immacolata"; Tab_Feste[10] = "1225Natale"; Tab_Feste[11] = "1226S. Stefano"; Tab_Feste[12] = "9999"; var Tab_Mese = new Array(); Tab_Mese[0] = ""; Tab_Mese[1] = "Gennaio"; Tab_Mese[2] = "Febbraio"; Tab_Mese[3] = "Marzo"; Tab_Mese[4] = "Aprile"; Tab_Mese[5] = "Maggio"; Tab_Mese[6] = "Giugno"; Tab_Mese[7] = "Luglio"; Tab_Mese[8] = "Agosto"; Tab_Mese[9] = "Settembre"; Tab_Mese[10] = "Ottobre"; Tab_Mese[11] = "Novembre"; Tab_Mese[12] = "Dicembre"; var Tab_Week = new Array(); Tab_Week[0] = ""; Tab_Week[1] = "Lu"; Tab_Week[2] = "Ma"; Tab_Week[3] = "Me"; Tab_Week[4] = "Gi"; Tab_Week[5] = "Ve"; Tab_Week[6] = "Sa"; Tab_Week[7] = "Do"; function Init_Data(){ var da = new Date(); Memo_Mese = da.getMonth()+1; Memo_Anno = da.getYear(); Cerca_Data(""); } function Easter_Data(y){ var a = y % 19; var b = Math.floor(y/100); var c = y % 100; var d = Math.floor(b/4); var e = b % 4; var f = Math.floor((b+8)/25); var g = Math.floor((b-f+1)/3); var h = (19*a+b-d-g+15) % 30; var i = Math.floor(c/4); var k = c % 4; var l = (32+2*e+2*i-h-k) % 7; var m = Math.floor((a+11*h+22*l)/451); var n = Math.floor((h+l-7*m+114)/31); var p = (h+l-7*m+114) % 31; p = Math.round(p+1); p2 = p + 1; var gg = String(p) ; if (gg.length < 2) { gg = '0' + gg; } var g2 = String(p2) ; if (g2.length < 2) { g2 = '0' + g2; } var mm = String(n) ; if (mm.length < 2) { mm = '0' + mm; } Tab_Feste[2] = mm + gg + Tab_Feste[2]; Tab_Feste[3] = mm + g2 + Tab_Feste[3]; } function Cerca_Data(val){ if (val == "A-") { Memo_Anno = Memo_Anno - 1; } if (val == "A+") { Memo_Anno = Memo_Anno + 1; } if (val == "M-") { Memo_Mese = Memo_Mese - 1; if (Memo_Mese == 0) { Memo_Mese = 12; Memo_Anno = Memo_Anno - 1; } } if (val == "M+") { Memo_Mese = Memo_Mese + 1; if (Memo_Mese == 13) { Memo_Mese = 1; Memo_Anno = Memo_Anno + 1; } } Easter_Data(Memo_Anno); var gi = new Date(Memo_Anno + '/' + Memo_Mese + '/01'); var wi = gi.getDay(); if (wi == 0) { wi = 7; } var df = new Date(Memo_Anno, Memo_Mese, 0); var gf = df.getDate(); document.forms[0].Anno.value=Memo_Anno; document.forms[0].Anno_m.value='<'; document.forms[0].Anno_p.value='>'; document.forms[0].Mese.value=Tab_Mese[Memo_Mese]; document.forms[0].Mese_m.value='<'; document.forms[0].Mese_p.value='>'; for (ctr = 1; ctr < 8; ctr = ctr + 1) { eval('document.forms[0].G_' + ctr + '.value=Tab_Week[ctr];'); if (ctr == 6 | ctr == 7) { eval('document.forms[0].G_' + ctr + '.style.backgroundColor="#40FF40";'); } } var ctr_gg = 0; for (; ctr < 50; ctr = ctr + 1) { eval('document.forms[0].G_' + ctr + '.style.backgroundColor="transparent";'); eval('document.forms[0].G_' + ctr + '.value="";'); if (((ctr-7) > 0 & (ctr-7) < 8) & (ctr-7) < wi) { ; } else if ((ctr_gg + 1) > gf) { ; } else { ctr_gg = ctr_gg + 1; eval('document.forms[0].G_' + ctr + '.value=ctr_gg;'); if (ctr == 6 | ctr == 7 | ctr == 13 | ctr == 14 | ctr == 20 | ctr == 21 | ctr == 27 | ctr == 28 | ctr == 34 | ctr == 35 | ctr == 41 | ctr == 42) { eval('document.forms[0].G_' + ctr + '.style.backgroundColor="#29B8EC";'); } for (ind = 0; Tab_Feste[ind] != "9999"; ind++) { Com_Mese = parseInt(Tab_Feste[ind].substring(0, 2),10); Com_Gior = parseInt(Tab_Feste[ind].substring(2, 4),10); if (Com_Mese == parseInt(Memo_Mese,10) & Com_Gior == parseInt(ctr_gg,10)) { eval('document.forms[0].G_' + ctr + '.style.backgroundColor="#FF0000";'); } } } } } </script> <form> <table width=100% cellspacing=0 cellpadding=0 border=0> <tr> <td align=center> <input type=button title="click x anno prec." name="Anno_m" onClick="Cerca_Data('A-');" style="font: bold 7pt Verdana, fantasy; color: #FF0000; background-color: transparent; text-align: center; border: 0; width: 8px; "> <input type=text disabled title="" name="Anno" style="font: normal 7pt Verdana, fantasy; color: #000000; background-color: #40FF40; text-align: center; border: 0; width: 60px; "> <input type=button title="click x anno succ." name="Anno_p" onClick="Cerca_Data('A+');" style="font: bold 7pt Verdana, fantasy; color: #FF0000; background-color: transparent; text-align: center; border: 0; width: 8px; "> </td> </tr> <tr> <td align=center> <input type=button title="click x mese prec." name="Mese_m" onClick="Cerca_Data('M-');" style="font: bold 7pt Verdana, fantasy; color: #FF0000; background-color: transparent; text-align: center; border: 0; width: 8px; "> <input type=text disabled title="" name="Mese" style="font: normal 7pt Verdana, fantasy; color: #000000; background-color: #29B8EC; text-align: center; border: 0; width: 60px; "> <input type=button title="click x mese succ." name="Mese_p" onClick="Cerca_Data('M+');" style="font: bold 7pt Verdana, fantasy; color: #FF0000; background-color: transparent; text-align: center; border: 0; width: 8px; "> </td> <? $ctr_all = 0; for ($ctr_rig = 1; $ctr_rig < 8; $ctr_rig++) { ?> </tr> <tr> <td align=center> <? for ($ctr_col = 1; $ctr_col < 8; $ctr_col++) { $ctr_all += 1; ?> <input type=text disabled title="" name="G_<? echo $ctr_all; ?>" style="font: normal 6pt Verdana, fantasy; color: #000000; background-color: transparent; text-align: right; border: 0 0 0 0; margin-top: 0; margin-right: -1; margin-bottom: +3; margin-left: -1; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; height: 10px; width: 12px; "> <? } ?> </td> <? } ?> </tr> </table> </form> </html> <script>Init_Data();</script> <? ?>
Cosi' come si trova visualizza il calendario nel modo piu' piccolo che sono riuscito a fare.
Vorrei ancora schiacciare le righe dei giorni del mese verso l'alto, compattando un po' di piu' gli spazi fra una riga e l'altra.
Help please![]()
wdb

Rispondi quotando