19. juni 2006 - 20:44Der er
2 kommentarer og 1 løsning
Dato i dropdown
Hej...
Jeg skal bruge et asp-script der automatisk genererer datoer i tre selectboxen, og "selecter" dags dato. Det er vel noget løkkeværk der skal laves... Altså:
| 19. | | juni | | 2006 |
i select nr. 1 skal den skrive tallene fra 1-31, i nr 2 alle månederne, og i nr 3 årstal 3 år tilbage og 3 år frem.
<select size="1" name="DateDay" class="Select" style="width: 45"> <option <% if Cstr(session("day")) = "1" then%>selected <% end if %>value="1">1</option> <option <% if Cstr(session("day")) = "2" then%>selected <% end if %>value="2">2</option> <option <% if Cstr(session("day")) = "3" then%>selected <% end if %>value="3">3</option> <option <% if Cstr(session("day")) = "4" then%>selected <% end if %>value="4">4</option> <option <% if Cstr(session("day")) = "5" then%>selected <% end if %>value="5">5</option> <option <% if Cstr(session("day")) = "6" then%>selected <% end if %>value="6">6</option> <option <% if Cstr(session("day")) = "7" then%>selected <% end if %>value="7">7</option> <option <% if Cstr(session("day")) = "8" then%>selected <% end if %>value="8">8</option> <option <% if Cstr(session("day")) = "9" then%>selected <% end if %>value="9">9</option> <option <% if Cstr(session("day")) = "10" then%>selected <% end if %>value="10">10</option> <option <% if Cstr(session("day")) = "11" then%>selected <% end if %>value="11">11</option> <option <% if Cstr(session("day")) = "12" then%>selected <% end if %>value="12">12</option> <option <% if Cstr(session("day")) = "13" then%>selected <% end if %>value="13">13</option> <option <% if Cstr(session("day")) = "14" then%>selected <% end if %>value="14">14</option> <option <% if Cstr(session("day")) = "15" then%>selected <% end if %>value="15">15</option> <option <% if Cstr(session("day")) = "16" then%>selected <% end if %>value="16">16</option> <option <% if Cstr(session("day")) = "17" then%>selected <% end if %>value="17">17</option> <option <% if Cstr(session("day")) = "18" then%>selected <% end if %>value="18">18</option> <option <% if Cstr(session("day")) = "19" then%>selected <% end if %>value="19">19</option> <option <% if Cstr(session("day")) = "20" then%>selected <% end if %>value="20">20</option> <option <% if Cstr(session("day")) = "21" then%>selected <% end if %>value="21">21</option> <option <% if Cstr(session("day")) = "22" then%>selected <% end if %>value="22">22</option> <option <% if Cstr(session("day")) = "23" then%>selected <% end if %>value="23">23</option> <option <% if Cstr(session("day")) = "24" then%>selected <% end if %>value="24">24</option> <option <% if Cstr(session("day")) = "25" then%>selected <% end if %>value="25">25</option> <option <% if Cstr(session("day")) = "26" then%>selected <% end if %>value="26">26</option> <option <% if Cstr(session("day")) = "27" then%>selected <% end if %>value="27">27</option> <option <% if Cstr(session("day")) = "28" then%>selected <% end if %>value="28">28</option> <option <% if Cstr(session("day")) = "29" then%>selected <% end if %>value="29">29</option> <option <% if Cstr(session("day")) = "30" then%>selected <% end if %>value="30">30</option> <option <% if Cstr(session("day")) = "31" then%>selected <% end if %>value="31">31</option> </select>
<select size="1" name="DateMonth" class="Select" style="width: 108"> <option <% if Cstr(session("month")) = "1" then%>selected <% end if %>value="1">Januar</option> <option <% if Cstr(session("month")) = "2" then%>selected <% end if %>value="2">Februar</option> <option <% if Cstr(session("month")) = "3" then%>selected <% end if %>value="3">Marts</option> <option <% if Cstr(session("month")) = "4" then%>selected <% end if %>value="4">April</option> <option <% if Cstr(session("month")) = "5" then%>selected <% end if %>value="5">Maj</option> <option <% if Cstr(session("month")) = "6" then%>selected <% end if %>value="6">Juni</option> <option <% if Cstr(session("month")) = "7" then%>selected <% end if %>value="7">Juli</option> <option <% if Cstr(session("month")) = "8" then%>selected <% end if %>value="8">August</option> <option <% if Cstr(session("month")) = "9" then%>selected <% end if %>value="9">September</option> <option <% if Cstr(session("month")) = "10" then%>selected <% end if %>value="10">Oktober</option> <option <% if Cstr(session("month")) = "11" then%>selected <% end if %>value="11">November</option> <option <% if Cstr(session("month")) = "12" then%>selected <% end if %>value="12">December</option> </select>
<select size="1" name="DateYear" class="Select" style="width: 60"> <option <% if Cstr(session("year")) = "2006" then%>selected <% end if %>value="2006">2006</option> <option <% if Cstr(session("year")) = "2007" then%>selected <% end if %>value="2007">2007</option> <option <% if Cstr(session("year")) = "2008" then%>selected <% end if %>value="2008">2008</option> <option <% if Cstr(session("year")) = "2009" then%>selected <% end if %>value="2009">2009</option> <option <% if Cstr(session("year")) = "2010" then%>selected <% end if %>value="2010">2010</option> </select>
before = year(date()) - 3 nowYear = year(date()) after = year(date()) + 3 %>
<select name="day"> <% Dim d
For d = 1 to 31 %> <option <% if day(date()) = d then%>selected <% end if %>value="<%=d%>"><%=d%></option> <% Next %> </select>
<select name="month"> <% Dim m
For m = 1 to 12 %> <option <% if month(date()) = m then%>selected <% end if %>value="<%=m%>"><%=m%></option> <% Next %> </select>
<select name="month"> <% Dim y
For y = before to after %> <option <% if year(date()) = y then%>selected <% end if %>value="<%=y%>"><%=y%></option> <% Next %> </select>
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.