Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente bannato
    Registrato dal
    Feb 2011
    Messaggi
    105

    calendario il cui colore delle date cambia in base ad un select

    In pratica, in un form ho un select dove seleziono la destinazione del mio viaggio (ad es. Amsterdam). in seguito ho un campo dove inserire la data di partenza che sfrutta un calendario. Vorrei che su quel calendario, in base alla selezione precedentemente fatta, i giorni utili (quelli in cui è possibile partire, ad esempio tutti i lunedì e sabato) siano evidenziati con un altro colore. Il calendario presente sul file html richiama tre file:
    1. theme.css
    2. calendar.js
    3. calendar-it.js

    Attualmente il colore diverso è solo quello della domenica (colore rosso) ed ho notato che è possibile cambiare colore dei giorni operando sul terzo file (calendar-it.js) nella parte relativa a: Calendar._TT["WEEKEND"] = "0". Dove se al possto dello 0 sostituisco con 6, allora nel calendario il giorno segnalato in rosso è il sabato.
    Forse ci vorrebbe quindi una funzione JS che, se seleziono Amsterdam, allora Calendar._TT["WEEKEND"] = "1, 5". se seleziono Parigi allora ["WEEKEND"] = "0, 4". etc. PS: sulla virgola non sono sicuro.

    Questo è il file html:

    <!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" lang="it">
    <head>
    <link rel="stylesheet" type="text/css" media="all"
    href="skins/aqua/theme.css" title="Aqua" />
    <script type="text/javascript" src="calendar.js"></script>
    <script type="text/javascript" src="calendar-it.js"></script>
    <script type="text/javascript">
    var oldLink = null;
    function setActiveStyleSheet(link, title) {
    var i, a, main;
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
    a.disabled = true;
    if(a.getAttribute("title") == title) a.disabled = false;
    }
    }
    if (oldLink) oldLink.style.fontWeight = 'normal';
    oldLink = link;
    link.style.fontWeight = 'bold';
    return false;
    }
    // This function gets called when the end-user clicks on some date.
    function selected(cal, date) {
    cal.sel.value = date; // just update the date in the input field.
    if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    cal.callCloseHandler();
    }
    function closeHandler(cal) {
    cal.hide(); // hide the calendar
    // cal.destroy();
    _dynarch_popupCalendar = null;
    }
    function showCalendar(id, format, showsTime, showsOtherMonths) {
    var el = document.getElementById(id);
    if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide(); // so we hide it first.
    } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
    cal.showsTime = true;
    cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
    cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal; // remember it in the global var
    cal.setRange(1900, 2070); // min/max year allowed.
    cal.create();
    }
    _dynarch_popupCalendar.setDateFormat(format); // set the specified date format
    _dynarch_popupCalendar.parseDate(el.value); // try to parse the text in field
    _dynarch_popupCalendar.sel = el; // inform it what input field we use
    _dynarch_popupCalendar.showAtElement(el.nextSiblin g, "Br"); // show the calendar
    return false;
    }
    var MINUTE = 60 * 1000;
    var HOUR = 60 * MINUTE;
    var DAY = 24 * HOUR;
    var WEEK = 7 * DAY;
    function isDisabled(date) {
    var today = new Date();
    return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
    }
    function flatSelected(cal, date) {
    var el = document.getElementById("preview");
    el.innerHTML = date;
    }
    function showFlatCalendar() {
    var parent = document.getElementById("display");
    var cal = new Calendar(0, null, flatSelected);
    cal.weekNumbers = false;
    cal.setDisabledHandler(isDisabled);
    cal.setDateFormat("%A, %B %e");
    cal.create(parent);
    cal.show();
    }
    </script>
    </head>
    <body style="color: rgb(0, 0, 0);" alink="#ee0000"
    link="#0000ee" vlink="#551a8b">
    <form enctype="multipart/form-data" class="subb"
    method="post" action="mail_prenotazione.php">


    <table style="text-align: left;" border="0"
    cellpadding="1" cellspacing="2">
    <caption style="font-weight: bold; color: rgb(51, 51, 51);">Prenota
    ora il tuo week end con partenza da Pescara!!!</caption> <tbody>
    <tr>
    <td style="height: 10px; width: 150px;"></td>
    <td style="width: 403px;"></td>
    </tr>
    <tr>
    <td style="width: 150px;"><span
    style="font-weight: bold; color: rgb(51, 51, 51);">Dettaglio
    volo</span></td>
    <td style="width: 403px;"></td>
    </tr>
    <tr>
    <td style="width: 150px;">In partenza da:</td>
    <td style="width: 403px;"><input
    readonly="readonly" value="Pescara" name="partenza"
    size="17" /></td>
    </tr>
    <tr>
    <td style="width: 150px;">Destinazione:</td>
    <td style="width: 403px;">
    <select name="product"
    onchange="updateSum( this.form, 'product', 'quantity', 'price');">
    <option selected="selected">Scegli destinazione</option>
    <option value="69 Amsterdam">Amsterdam</option>
    <option value="59 Barcellona">Barcellona</option>
    <option value="69 Bruxelles">Bruxelles</option>
    <option value="69 Cagliari">Cagliari</option>
    <option value="69 Colonia">Colonia/Bonn</option>
    <option value="69 Francoforte">Francoforte</option>
    <option value="69 Londra">Londra</option>
    <option value="69 Lussemburgo">Lussenburgo/Treviri</option>
    <option value="69 Milano">Milano/Bergamo</option>
    <option value="69 Oslo">Oslo</option>
    <option value="69 Parigi">Parigi</option>
    <option value="69 Trapani">Trapani</option>
    </select>
    </td>
    </tr>
    <tr>
    <td style="width: 150px;">Data di partenza:</td>
    <td style="width: 403px;"><input name="data1"
    id="sel3" size="10" /><input
    value="vedi calendario"
    onclick="return showCalendar('sel3', '%d/%m/%Y');" type="reset" /></td>
    </tr>
    <tr>
    <td style="width: 150px;">Data di ritorno:</td>
    <td style="width: 403px;"><input name="data2"
    id="sel4" size="10" /><input
    value="vedi calendario"
    onclick="return showCalendar('sel4', '%d/%m/%Y');" type="reset" /></td>
    </tr>
    <td style="width: 403px;"> <input name="A1"
    value="Prosegui" onclick="controllo(this.form);"
    type="button" /></td>
    </tbody>
    </table>
    </form>
    </body>
    </html>

  2. #2
    Utente bannato
    Registrato dal
    Feb 2011
    Messaggi
    105
    questo è il file calendar-it.js

    // ** I18N

    // Calendar EN language
    // Author: Mihai Bazon, <mihai_bazon@yahoo.com>
    // Translator: Fabio Di Bernardini, <altraqua@email.it>
    // Encoding: any
    // Distributed under the same terms as the calendar itself.

    // For translators: please use UTF-8 if possible. We strongly believe that
    // Unicode is the answer to a real internationalized world. Also please
    // include your contact information in the header, as can be seen above.

    // full day names
    Calendar._DN = new Array
    ("Domenica",
    "Lunedì",
    "Martedì",
    "Mercoledì",
    "Giovedì",
    "Venerdì",
    "Sabato",
    "Domenica");

    // Please note that the following array of short day names (and the same goes
    // for short month names, _SMN) isn't absolutely necessary. We give it here
    // for exemplification on how one can customize the short day names, but if
    // they are simply the first N letters of the full name you can simply say:
    //
    // Calendar._SDN_len = N; // short day name length
    // Calendar._SMN_len = N; // short month name length
    //
    // If N = 3 then this is not needed either since we assume a value of 3 if not
    // present, to be compatible with translation files that were written before
    // this feature.

    // short day names
    Calendar._SDN = new Array
    ("Dom",
    "Lun",
    "Mar",
    "Mer",
    "Gio",
    "Ven",
    "Sab",
    "Dom");

    // full month names
    Calendar._MN = new Array
    ("Gennaio",
    "Febbraio",
    "Marzo",
    "Aprile",
    "Maggio",
    "Giugno",
    "Luglio",
    "Augosto",
    "Settembre",
    "Ottobre",
    "Novembre",
    "Dicembre");

    // short month names
    Calendar._SMN = new Array
    ("Gen",
    "Feb",
    "Mar",
    "Apr",
    "Mag",
    "Giu",
    "Lug",
    "Ago",
    "Set",
    "Ott",
    "Nov",
    "Dic");

    // tooltips
    Calendar._TT = {};
    Calendar._TT["INFO"] = "Informazioni sul calendario";

    Calendar._TT["ABOUT"] =
    "Selezione data:\n" +
    "- Usa \xab, \xbb per selezionare l'anno\n" +
    "- Usa " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per i mesi\n" +
    "- Tieni premuto a lungo il mouse per accedere alle funzioni di selezione veloce.";
    Calendar._TT["ABOUT_TIME"] = "\n\n" +
    "Selezione orario:\n" +
    "- Clicca sul numero per incrementarlo\n" +
    "- o Shift+click per decrementarlo\n" +
    "- o click e sinistra o destra per variarlo.";

    Calendar._TT["PREV_YEAR"] = "Anno prec.(clicca a lungo per il menù)";
    Calendar._TT["PREV_MONTH"] = "Mese prec. (clicca a lungo per il menù)";
    Calendar._TT["GO_TODAY"] = "Oggi";
    Calendar._TT["NEXT_MONTH"] = "Pross. mese (clicca a lungo per il menù)";
    Calendar._TT["NEXT_YEAR"] = "Pross. anno (clicca a lungo per il menù)";
    Calendar._TT["SEL_DATE"] = "Seleziona data";
    Calendar._TT["DRAG_TO_MOVE"] = "Trascina per spostarlo";
    Calendar._TT["PART_TODAY"] = " (oggi)";

    // the following is to inform that "%s" is to be the first day of week
    // %s will be replaced with the day name.
    Calendar._TT["DAY_FIRST"] = "Mostra prima %s";

    // This may be locale-dependent. It specifies the week-end days, as an array
    // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
    // means Monday, etc.
    Calendar._TT["WEEKEND"] = "0";

    Calendar._TT["CLOSE"] = "Chiudi";
    Calendar._TT["TODAY"] = "Oggi";
    Calendar._TT["TIME_PART"] = "(Shift-)Click o trascina per cambiare il valore";

    // date formats
    Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y";
    Calendar._TT["TT_DATE_FORMAT"] = "%a:%b:%e";

    Calendar._TT["WK"] = "set";
    Calendar._TT["TIME"] = "Ora:";

  3. #3
    Utente bannato
    Registrato dal
    Feb 2011
    Messaggi
    105
    questo il file: theme.css

    /* Distributed as part of The Coolest DHTML Calendar
    Author: Mihai Bazon, www.bazon.net/mishoo
    Copyright Dynarch.com 2005, www.dynarch.com
    */

    /* The main calendar widget. DIV containing a table. */

    div.calendar { position: relative; }

    .calendar, .calendar table {
    border: 1px solid #bdb2bf;
    font-size: 11px;
    color: #000;
    cursor: default;
    background: url("normal-bg.gif");
    font-family: "trebuchet ms",verdana,tahoma,sans-serif;
    }

    .calendar {
    border-color: #797979;
    }

    /* Header part -- contains navigation buttons and day names. */

    .calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
    text-align: center; /* They are the navigation buttons */
    padding: 2px; /* Make the buttons seem like they're pressing */
    background: url("title-bg.gif") repeat-x 0 100%; color: #000;
    font-weight: bold;
    }

    .calendar .nav {
    font-family: verdana,tahoma,sans-serif;
    }

    .calendar .nav div {
    background: transparent url("menuarrow.gif") no-repeat 100% 100%;
    }

    .calendar thead tr { background: url("title-bg.gif") repeat-x 0 100%; color: #000; }

    .calendar thead .title { /* This holds the current "month, year" */
    font-weight: bold; /* Pressing it will take you to the current date */
    text-align: center;
    padding: 2px;
    background: url("title-bg.gif") repeat-x 0 100%; color: #000;
    }

    .calendar thead .headrow { /* Row <TR> containing navigation buttons */
    }

    .calendar thead .name { /* Cells <TD> containing the day names */
    border-bottom: 1px solid #797979;
    padding: 2px;
    text-align: center;
    color: #000;
    }

    .calendar thead .weekend { /* How a weekend day name shows in header */
    color: #c44;
    }

    .calendar thead .hilite { /* How do the buttons in header appear when hover */
    background: url("hover-bg.gif");
    border-bottom: 1px solid #797979;
    padding: 2px 2px 1px 2px;
    }

    .calendar thead .active { /* Active (pressed) buttons in header */
    background: url("active-bg.gif"); color: #fff;
    padding: 3px 1px 0px 3px;
    border-bottom: 1px solid #797979;
    }

    .calendar thead .daynames { /* Row <TR> containing the day names */
    background: url("dark-bg.gif");
    }

    /* The body part -- contains all the days in month. */

    .calendar tbody .day { /* Cells <TD> containing month days dates */
    font-family: verdana,tahoma,sans-serif;
    width: 2em;
    color: #000;
    text-align: right;
    padding: 2px 4px 2px 2px;
    }
    .calendar tbody .day.othermonth {
    font-size: 80%;
    color: #999;
    }
    .calendar tbody .day.othermonth.oweekend {
    color: #f99;
    }

    .calendar table .wn {
    padding: 2px 3px 2px 2px;
    border-right: 1px solid #797979;
    background: url("dark-bg.gif");
    }

    .calendar tbody .rowhilite td,
    .calendar tbody .rowhilite td.wn {
    background: url("rowhover-bg.gif");
    }

    .calendar tbody td.today { font-weight: bold; /* background: url("today-bg.gif") no-repeat 70% 50%; */ }

    .calendar tbody td.hilite { /* Hovered cells <TD> */
    background: url("hover-bg.gif");
    padding: 1px 3px 1px 1px;
    border: 1px solid #bbb;
    }

    .calendar tbody td.active { /* Active (pressed) cells <TD> */
    padding: 2px 2px 0px 2px;
    }

    .calendar tbody td.weekend { /* Cells showing weekend days */
    color: #c44;
    }

    .calendar tbody td.selected { /* Cell showing selected date */
    font-weight: bold;
    border: 1px solid #797979;
    padding: 1px 3px 1px 1px;
    background: url("active-bg.gif"); color: #fff;
    }

    .calendar tbody .disabled { color: #999; }

    .calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
    visibility: hidden;
    }

    .calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
    display: none;
    }

    /* The footer part -- status bar and "Close" button */

    .calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
    text-align: center;
    background: #565;
    color: #fff;
    }

    .calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
    padding: 2px;
    background: url("status-bg.gif") repeat-x 0 0; color: #000;
    }

    .calendar tfoot .hilite { /* Hover style for buttons in footer */
    background: #afa;
    border: 1px solid #084;
    color: #000;
    padding: 1px;
    }

    .calendar tfoot .active { /* Active (pressed) style for buttons in footer */
    background: #7c7;
    padding: 2px 0px 0px 2px;
    }

    /* Combo boxes (menus that display months/years for direct selection) */

    .calendar .combo {
    position: absolute;
    display: none;
    top: 0px;
    left: 0px;
    width: 4em;
    cursor: default;
    border-width: 0 1px 1px 1px;
    border-style: solid;
    border-color: #797979;
    background: url("normal-bg.gif"); color: #000;
    z-index: 100;
    font-size: 90%;
    }

    .calendar .combo .label,
    .calendar .combo .label-IEfix {
    text-align: center;
    padding: 1px;
    }

    .calendar .combo .label-IEfix {
    width: 4em;
    }

    .calendar .combo .hilite {
    background: url("hover-bg.gif"); color: #000;
    }

    .calendar .combo .active {
    background: url("active-bg.gif"); color: #fff;
    font-weight: bold;
    }

    .calendar td.time {
    border-top: 1px solid #797979;
    padding: 1px 0px;
    text-align: center;
    background: url("dark-bg.gif");
    }

    .calendar td.time .hour,
    .calendar td.time .minute,
    .calendar td.time .ampm {
    padding: 0px 5px 0px 6px;
    font-weight: bold;
    background: url("normal-bg.gif"); color: #000;
    }

    .calendar td.time .hour,
    .calendar td.time .minute {
    font-family: monospace;
    }

    .calendar td.time .ampm {
    text-align: center;
    }

    .calendar td.time .colon {
    padding: 0px 2px 0px 3px;
    font-weight: bold;
    }

    .calendar td.time span.hilite {
    background: url("hover-bg.gif"); color: #000;
    }

    .calendar td.time span.active {
    background: url("active-bg.gif"); color: #fff;
    }

  4. #4
    Utente bannato
    Registrato dal
    Feb 2011
    Messaggi
    105
    il file calendar.js è invece molto lungo e non risco ad inserirlo.

    Speriamo che non serva, altrimenti un modo per farlo vedere credo si trovi.

    Garazie anticipatamente

  5. #5
    Utente bannato
    Registrato dal
    Feb 2011
    Messaggi
    105
    qualcosa di simile viene fatto sul sito http://www.flyonair.it/ ma non riesco ad adattarlo.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.