![]() |
|
| |||||||
|
| | Seçenekler |
|
#1
| ||||
| | ||||
dropdown ile tarihi doğru seçme örnek: 31 şubat seçilemezHTML-Kodu: <!-- THREE STEPS TO INSTALL TRUE DATE SELECTOR: 1. Copy the coding into the HEAD of your HTML document 2. Add the onLoad event handler into the BODY tag 3. Put the last coding into the BODY of your HTML document --> <!-- STEP ONE: Paste this code into the HEAD of your HTML document --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Created by: Lee Hinder, --> <!-- Begin //set todays date Now = new Date(); NowDay = Now.getDate(); NowMonth = Now.getMonth(); NowYear = Now.getYear(); if (NowYear < 2000) NowYear += 1900; //for Netscape //function for returning how many days there are in a month including leap years function DaysInMonth(WhichMonth, WhichYear) { var DaysInMonth = 31; if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30; if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4)) DaysInMonth = 28; if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4)) DaysInMonth = 29; return DaysInMonth; } //function to change the available days in a months function ChangeOptionDays(Which) { DaysObject = eval("document.Form1." + Which + "Day"); MonthObject = eval("document.Form1." + Which + "Month"); YearObject = eval("document.Form1." + Which + "Year"); Month = MonthObject[MonthObject.selectedIndex].text; Year = YearObject[YearObject.selectedIndex].text; DaysForThisSelection = DaysInMonth(Month, Year); CurrentDaysInSelection = DaysObject.length; if (CurrentDaysInSelection > DaysForThisSelection) { for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++) { DaysObject.options[DaysObject.options.length - 1] = null } } if (DaysForThisSelection > CurrentDaysInSelection) { for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++) { NewOption = new Option(DaysObject.options.length + 1); DaysObject.add(NewOption); } } if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0; } //function to set options to today function SetToToday(Which) { DaysObject = eval("document.Form1." + Which + "Day"); MonthObject = eval("document.Form1." + Which + "Month"); YearObject = eval("document.Form1." + Which + "Year"); YearObject[0].selected = true; MonthObject[NowMonth].selected = true; ChangeOptionDays(Which); DaysObject[NowDay-1].selected = true; } //function to write option years plus x function WriteYearOptions(YearsAhead) { line = ""; for (i=0; i<YearsAhead; i++) { line += "<OPTION>"; line += NowYear + i; } return line; } // End --> </script> </HEAD> <!-- STEP TWO: Insert the onLoad event handler into your BODY tag --> <BODY onLoad="SetToToday('FirstSelect');"> <!-- STEP THREE: Copy this code into the BODY of your HTML document --> <FORM name="Form1"> <SELECT name="FirstSelectDay"> <OPTION>1 <OPTION>2 <OPTION>3 <OPTION>4 <OPTION>5 <OPTION>6 <OPTION>7 <OPTION>8 <OPTION>9 <OPTION>10 <OPTION>11 <OPTION>12 <OPTION>13 <OPTION>14 <OPTION>15 <OPTION>16 <OPTION>17 <OPTION>18 <OPTION>19 <OPTION>20 <OPTION>21 <OPTION>22 <OPTION>23 <OPTION>24 <OPTION>25 <OPTION>26 <OPTION>27 <OPTION>28 <OPTION>29 <OPTION>30 <OPTION>31 </SELECT> <SELECT name="FirstSelectMonth" onchange="ChangeOptionDays('FirstSelect')"> <OPTION>Jan <OPTION>Feb <OPTION>Mar <OPTION>Apr <OPTION>May <OPTION>Jun <OPTION>Jul <OPTION>Aug <OPTION>Sep <OPTION>Oct <OPTION>Nov <OPTION>Dec </SELECT> <SELECT name="FirstSelectYear" onchange="ChangeOptionDays('FirstSelect')"> <SCRIPT language="JavaScript"> document.write(WriteYearOptions(50)); </SCRIPT> </SELECT> </FORM> <p><center> <font face="arial, helvetica" size"-2">Free JavaScripts provided<br> by <a href="http://javascriptsource.com">The JavaScript Source</a></font> </center><p> <!-- Script Size: 4.29 KB --> |
![]() |
| Arama Etiketleri: dogru, dropdown, ornek, secilemez, secme, subat, tarihi |
| Seçenekler | |
| |
Benzer Konular | ||||
| Konu | Konu Açanlar | Forum | Cevaplar | Güncel Mesajlar |
| Bilim ve Teknik Dergisi 2008 Şubat Sayısı - pdf | adminkral | Webmastersitesi çöplüğü | 0 | 09-03-2008 05:15 |
| Wallpaper olarak kullanabileceğiniz Şubat 2008 Takvimleri | spy_scorpion | Photoshop | 0 | 06-02-2008 11:09 |
| Marasshell Şubat Ayı Host Fiyatları !! | Marasshell | Hosting tavsiye | 0 | 01-02-2008 04:31 |
| Açılış Sayfalarını Seçme « | kadınca | Google Adwords | 0 | 10-12-2007 12:48 |
| doğru tarihi seçme menüsü | banias | Javascript kodları | 0 | 25-11-2007 11:59 |
![]() |