Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it L'avatar di diegoctn
    Registrato dal
    May 2001
    Messaggi
    2,118

    Selected giorno, mese, anno

    Ragazzi ho questo cruccio. Ho un menu a tendina per il giorno, uno per il mese e uno per l'anno. Vorrei che di default fosse visualizzato oggi (per il giorno), mese corrente (per il mese) e anno corrente (per l'anno).
    codice:
    <select name="giorno"> 
    <% 
    for ctInd=1 to 31 
    %> 
    <option value="<%=ctInd%>"><%=ctInd%></option> 
    <% 
    next 
    %> 
    </select> 
    </div> 
    </td> 
    <td width="10%">
    <div align="center"> 
    <select name="mese"> 
    <% 
    for ctInd=1 to 12 
    %> 
    <option value="<%=ctInd%>"><%= monthName(ctInd)%></option> 
    <% 
    next 
    %> 
    </select> 
    </div> 
    </td> 
    <td width="6%"> 
    <div align="center"> 
    <select name="anno"> 
    <% 
    for ctInd=datePart("yyyy",now) to datePart("yyyy",now) - 100 step -1 
    %> 
    <option value="<%=ctInd%>"><%=ctInd%></option> 
    <% 
    next 
    %> 
    </select>
    Ho provato con selected e varie ma non riesco..........avete consigli? Grazie mille, ragazzi

  2. #2
    salvati in variabili giorno, mese e anno corrente poi nella option fai il confronto:

    es:

    giorno_oggi = Day(date())

    <option <%if giorno_oggi = i then%> selected <%end if%> ></option>

    ...ancora credi a internet? :maLOL:

  3. #3
    Utente di HTML.it L'avatar di diegoctn
    Registrato dal
    May 2001
    Messaggi
    2,118
    Ok ma I cosa sarebbe?

  4. #4
    è la variabile di incremento che usi nel ciclo for. nel tuo caso è ctInd ....
    ...ancora credi a internet? :maLOL:

  5. #5
    Utente di HTML.it L'avatar di diegoctn
    Registrato dal
    May 2001
    Messaggi
    2,118
    Tanks

  6. #6
    codice:
    <select name="giorno"> 
    <% 
    for ctInd=1 to 31 
    %> 
    <option value="<%=ctInd%>"<% if datePart("d",date) = ctInd then %> selected="selected"<% end if %>><%=ctInd%></option> 
    <% 
    next 
    %> 
    </select> 
    </div> 
    </td> 
    <td width="10%">
    <div align="center"> 
    <select name="mese"> 
    <% 
    for ctInd=1 to 12 
    %> 
    <option value="<%=ctInd%>"<% if datePart("m",date) = ctInd then %> selected="selected"<% end if %>><%= monthName(ctInd)%></option> 
    <% 
    next 
    %> 
    </select> 
    </div> 
    </td> 
    <td width="6%"> 
    <div align="center"> 
    <select name="anno"> 
    <% 
    for ctInd=datePart("yyyy",now) to datePart("yyyy",now) - 100 step -1 
    %> 
    <option value="<%=ctInd%>"<% if datePart("yyyy",date) = ctInd then %> selected="selected"<% end if %>><%=ctInd%></option> 
    <% 
    next 
    %> 
    </select>

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.