Hey Leute
Kann mir jemand verraten, wie man solche Auswahlboxen für Alter (Tag, Monat, Jahr) einbaut? Das Modul vom Gecko zwecks Altersüberprüfung ist nich wirklich so sinnvoll, geht aber in die richtige Richtung
Hier kann eine Notiz zum Merk-Eintrag hinzugefügt werden (optional)
Geschlossen |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | <table align="center"> <tr> <td> <form name="verify" method="post" action="bub/index.php"> <center> <select size=1 name=birthmonth id="birthmonth"> <option value=0 selected>[Monat]</option> <option value=1>January</option> <option value=2>February</option> <option value=3>March</option> <option value=4>April</option> <option value=5>May</option> <option value=6>June</option> <option value=7>July</option> <option value=8>August</option> <option value=9>September</option> <option value=10>October</option> <option value=11>November</option> <option value=12>December</option></select> <select name=birthdate id="birthdate"> <option value=0 selected>[Tag]</option> <option value=1>1</option> <option value=2>2</option> <option value=3>3</option> <option value=4>4</option> <option value=5>5</option> <option value=6>6</option> <option value=7>7</option> <option value=8>8</option> <option value=9>9</option> <option value=10>10</option> <option value=11>11</option> <option value=12>12</option> <option value=13>13</option> <option value=14>14</option> <option value=15>15</option> <option value=16>16</option> <option value=17>17</option> <option value=18>18</option> <option value=19>19</option> <option value=20>20</option> <option value=21>21</option> <option value=22>22</option> <option value=23>23</option> <option value=24>24</option> <option value=25>25</option> <option value=26>26</option> <option value=27>27</option> <option value=28>28</option> <option value=29>29</option> <option value=30>30</option> <option value=31>31</option></select> <select name=birthyear id="birthyear"> <option value=0 selected>[Jahr]</option> <option value=2009>2009</option> <option value=2008>2008</option> <option value=2007>2007</option> <option value=2006>2006</option> <option value=2005>2005</option> <option value=2004>2004</option> <option value=2003>2003</option> <option value=2002>2002</option> <option value=2001>2001</option> <option value=2000>2000</option> <option value=1999>1999</option> <option value=1998>1998</option> <option value=1997>1997</option> <option value=1996>1996</option> <option value=1995>1995</option> <option value=1994>1994</option> <option value=1993>1993</option> <option value=1992>1992</option> <option value=1991>1991</option> <option value=1990>1990</option> <option value=1989>1989</option> <option value=1988>1988</option> <option value=1987>1987</option> <option value=1986>1986</option> <option value=1985>1985</option> <option value=1984>1984</option> <option value=1983>1983</option> <option value=1982>1982</option> <option value=1981>1981</option> <option value=1980>1980</option> <option value=1979>1979</option> <option value=1978>1978</option> <option value=1977>1977</option> <option value=1976>1976</option> <option value=1975>1975</option> <option value=1974>1974</option> <option value=1973>1973</option> <option value=1972>1972</option> <option value=1971>1971</option> <option value=1970>1970</option> <option value=1969>1969</option> <option value=1968>1968</option> <option value=1967>1967</option> <option value=1966>1966</option> <option value=1965>1965</option> <option value=1964>1964</option> <option value=1963>1963</option> <option value=1962>1962</option> <option value=1961>1961</option> <option value=1960>1960</option> <option value=1959>1959</option> <option value=1958>1958</option> <option value=1957>1957</option> <option value=1956>1956</option> <option value=1955>1955</option> <option value=1954>1954</option> <option value=1953>1953</option> <option value=1952>1952</option> <option value=1951>1951</option> <option value=1950>1950</option> <option value=1949>1949</option> <option value=1948>1948</option> <option value=1947>1947</option> <option value=1946>1946</option> <option value=1945>1945</option> <option value=1944>1944</option> <option value=1943>1943</option> <option value=1942>1942</option> <option value=1941>1941</option> <option value=1940>1940</option> <option value=1939>1939</option> <option value=1938>1938</option> <option value=1937>1937</option> <option value=1936>1936</option> <option value=1935>1935</option> <option value=1934>1934</option> <option value=1933>1933</option> <option value=1932>1932</option> <option value=1931>1931</option> <option value=1930>1930</option> <option value=1929>1929</option> <option value=1928>1928</option> <option value=1927>1927</option> <option value=1926>1926</option> <option value=1925>1925</option> <option value=1924>1924</option> <option value=1923>1923</option> <option value=1922>1922</option> <option value=1921>1921</option> <option value=1920>1920</option> <option value=1920>before</option> </select> <input id=Enter onclick=CheckAge(this.form) type=button value="Enter" name=Enter> </form> </center> </td> </tr> </table> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | //set some variables var invalid_date_msg = 'Please enter a valid date' ; var nocookies_msg = 'You must <a href="http://www.google.com/cookies.html" target="_blank">enable cookies</a> to enter this site' ; //set url if under age //use cookies? set to false for no cookies- var usecookies = true ; //set age ok URL if not using cookies var oknocookies = "index.html" ; function y2000(number) { return (number < 1000) ? number + 1900 : number; } function valDate(day,month,year) { var today = new Date(); year = ((!year) ? y2000(today.getYear()):year); month = ((!month) ? today.getMonth():month-1); if (!day) return false var test = new Date(year,month,day); if ( (y2000(test.getYear()) == year) && (month == test.getMonth()) && (day == test.getDate()) ) return true ; else return false } function MonthLength(month,year,isJulian) { var monthdays; if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10||month==12) {monthdays = 31;} else { if (month==2) { monthdays = 28; if (!(year%4) && (isJulian==1 || year%100 || !(year%400))) monthdays++; } else {monthdays = 30;} } return monthdays; } function CheckAge(form) { /* set age limit */ var ageLimit = 21; //Current Date Today= new Date(); var ytoday = Today.getFullYear(); var mtoday = Today.getMonth(); var dtoday = Today.getDate(); //add 1 ro current month mtoday +=1; // Get Date from the form var birthyear = document.getElementById( "birthyear" ).value; var birthmonth = document.getElementById( "birthmonth" ).value; var birthdate = document.getElementById( "birthdate" ).value; //alert(birthyear+"\n"+birthmonth+"\n"+birthdate); if ((birthdate == 0) || (birthmonth == 0) || (birthyear == 0)) { document.getElementById( 'errors' ).innerHTML=invalid_date_msg; document.getElementById( 'errors' ).style.display= "block" ; return ; } else { if (valDate(birthdate,birthmonth,birthyear)== false ) { document.getElementById( 'errors' ).innerHTML=invalid_date_msg; document.getElementById( 'errors' ).style.display= "block" ; return ; } } // if 0 use calendar length var mLength = 0; // 0 if Gregorian calendar var isJulian = 1; var mmonth=0; var yyear=0; var dday = dtoday-birthdate; // borrow days/months if necessary if (dday<0) { mtoday--; // Borrow months if necesssary. if (mtoday<1) { ytoday--; // months in year if (mLength) {mtoday=mtoday+parseInt(365/mLength);} else {mtoday=mtoday+12;} } if (mLength==0) { // add a leap day if necessary. monthdays=MonthLength(mtoday,ytoday,isJulian); dday=dday+monthdays; } // default month/days else {dday+=mLength;} // Use fixed month length } mmonth = mtoday - birthmonth; // borrow months if necessary if (mmonth<0) { ytoday--; if (mLength!=0) {mmonth=mmonth+parseInt(365/mLength);} else {mmonth=mmonth+12;} } yyear = ytoday - birthyear; //alert("ytoday "+ytoday+"\nbirthyear "+birthyear+"\nyyear "+yyear); // over ageLimit? submit form if (yyear>=ageLimit) { if (usecookies) document.forms.verify.submit(); else location = oknocookies; } else { //redirect to the under age url location = underage_url; } } //test for cookies function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=" ); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf( ";" ,c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } else return "" ; } function testCookie(c_name,value,expiredays) { var exdate= new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays== null ) ? "" : ";expires=" +exdate.toGMTString()); } function checkCookie() { //hide the no javascript default message document.getElementById( "nojs" ).style.display= "none" ; if (usecookies){ testCookie( 'username' , 'username' ,365); username=getCookie( 'username' ); if (usecookies && (username== null || username== "" )) { document.getElementById( 'errors' ).innerHTML=nocookies_msg; document.getElementById( 'errors' ).style.display= "block" ; } } } onload=checkCookie; //this is the test for cookies if cookies are enabled - //if cookies are enabled, adding <script type="text/javascript" src="intro/verify.js"></script> //to every page will check if the cookie is set and if not, redirect to index.html to verify function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=" ); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf( ";" ,c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } else return "" ; } //set usecookies to false to not use cookies if (usecookies) { agecookie=getCookie( 'age' ); loc = location.toString(); if (!agecookie && !(loc.indexOf( "index.html" )+1)) location= "index.html" ; } |
1 2 | //set url if under age var underage_url = "http://www.bobthebuilder.com/de/main.html"; |
Geschlossen | ||
![]() |
Zurück zu HTML, PHP, SQL,... |