Admin
Admin
Yaş : 30
Kayıt tarihi : 05/08/08
Mesaj Sayısı : 206
|
Konu: Sitene Takvim Ekle Cuma Ağus. 22, 2008 2:26 pm |
|
|
İşte kod aşağıda ....
- Kod:
-
<script language="Javascript"><br />//This Java script is free to the domain. All I ask is you send me an<br />//email to<br />//ddelong@csci.csusb.edu to let me know that you will be using it. This<br />//message must be included with the script if you copy it.<br /><!-- for sucky browsers<br />Months = new Array(12);<br />Months[0] = "January";<br />Months[1] = "February";<br />Months[2] = "March";<br />Months[3] = "April";<br />Months[4] = "May";<br />Months[5] = "June";<br />Months[6] = "July";<br />Months[7] = "August";<br />Months[8] = "September";<br />Months[9] = "October";<br />Months[10] = "November";<br />Months[11] = "December";<br />function PadSpaces(TheString)<br />{<br />var Spaces = " ";<br />len = Math.round((9 - TheString.length)/2);<br />return Spaces.substring(0,len) + TheString;<br />}<br />function NumLeapYears(StartYear, EndYear)<br />{<br />var LeapYears, i;<br />if (EndYear >= StartYear){<br />for(LeapYears = 0; StartYear <= EndYear; StartYear++)<br />if (IsLeapYear(StartYear)) LeapYears++;<br />}else{<br />for(LeapYears = 0; EndYear <= StartYear; EndYear++)<br />if (IsLeapYear(EndYear)) LeapYears++;<br />}<br />return LeapYears;<br />}<br />function IsLeapYear(Year)<br />{<br />if(Math.round(Year/4) == Year/4){<br />if(Math.round(Year/100) == Year/100){<br />if(Math.round(Year/400) == Year/400)<br />return true;<br />else return false;<br />}else return true;<br />}<br />return false;<br />}<br />function Trim(TheString)<br />{<br />var len;<br />len = TheString.length;<br />while(TheString.substring(0,1) == " "){ //trim left<br />TheString = TheString.substring(1, len);<br />len = TheString.length;<br />}<br />while(TheString.substring(len-1, len) == " "){ //trim right<br />TheString = TheString.substring(0, len-1);<br />len = TheString.length;<br />}<br />return TheString;<br />}<br />function DetermineMonthIdx()<br />{<br />var i, month, month_s, len;<br />month = Trim(document.calform.elements[4].value);<br />len = month.length;<br />for( i = 0; i <12; i++){<br />month_s = Months[i].substring(0,len);<br />if (month_s.toUpperCase() == month.toUpperCase())<br />return (i);<br />}<br />return -1;<br />}<br />function FindNewYearStartingDay(Year)<br />{<br />var LeapYears, Years, Day;<br />LeapYears = NumLeapYears(1995, Year);<br />if (Year >=1995)<br />Years = (Year -1995)+LeapYears;<br />else Years = (Year -1995)-LeapYears;<br />if (Year >=1995)<br />Day = Math.round(((Years/7 - Math.floor(Years/7))*7)+.1);<br />else Day = Math.round(((Years/7 - Math.ceil(Years/7))*7)-.1);<br />if (Year >=1995){<br />if(IsLeapYear(Year)) Day--;<br />}else Day += 7;<br />if(Day < 0) Day = 6;<br />if(Day > 6) Day = 0;<br />return Day;<br />}<br />function FindNumDaysInMonth(Year, Month)<br />{<br />if(Month == 1){<br />if(IsLeapYear(Year)) return 29;<br />else return 28;<br />}else{<br />if(Month >6) Month++;<br />if(Month/2 == Math.round(Month/2)) return 31;<br />}<br />return 30;<br />}<br />function FindMonthStartDay(NewYearDay, Year, Month)<br />{<br />var MonthStartDay;<br />AddArray = new Array(12);<br />AddArray[0]=0;AddArray[1]=3;AddArray[2]=3;AddArray[3]=6;<br />AddArray[4]=1;AddArray[5]=4;AddArray[6]=6;AddArray[7]=2;<br />AddArray[8]=5;AddArray[9]=0;AddArray[10]=3;AddArray[11]=5;<br />MonthStartDay = NewYearDay + AddArray[Month];<br />if(IsLeapYear(Year) && (Month ) > 1) MonthStartDay ++;<br />if (MonthStartDay > 6) MonthStartDay -= 7;<br />return MonthStartDay;<br />}<br />function FillCalendar()<br />{<br />var Year, Month, Midx, NewYearDay, MonthStartDay;<br />var NumDaysInMonth, i, t;<br />Year = parseFloat(document.calform.elements[1].value);<br />Month = document.calform.elements[4].value;<br />Midx = DetermineMonthIdx();<br />if (Midx == -1){<br />alert ("Can't recognize that month");<br />return;<br />}<br />NewYearDay = FindNewYearStartingDay(Year);<br />MonthStartDay = FindMonthStartDay(NewYearDay, Year, Midx);<br />NumDaysInMonth = FindNumDaysInMonth(Year, Midx);<br />for(i = 6; i < 43; i++){<br />t = i-5-MonthStartDay;<br />if ( t >= 1 && t <= NumDaysInMonth)<br />document.calform.elements[i].value =t;<br />else document.calform.elements[i].value = "";<br />}<br />}<br />function IncDecYear(val)<br />{<br />var valNum = parseInt(val);<br />var valNum2 = parseInt(document.calform.elements[1].value)<br />document.calform.elements[1].value = valNum2 + valNum;<br />FillCalendar()<br />}<br />function IncDecMonth(val)<br />{<br />var valNum = parseInt(val);<br />var Midx = DetermineMonthIdx();<br />Midx += valNum;<br />if(Midx > 11) Midx = 0;<br />if(Midx < 0) Midx = 11;<br />document.calform.elements[4].value = PadSpaces(Months[Midx]);<br />FillCalendar()<br />}<br />// --><br /></script><br /></HEAD><BODY><table border=1 bgcolor="#000000"><tr><td align=center><br /><table border=0 cellspacing=0><br /><form name="calform"><br /><tr><td align=center bgcolor="#000000"><input type=button value="<<" onClick="IncDecYear(-1)"></td><br /><th bgcolor="#aaaaaa" colspan=5 align=center><input size=4 type=text value="1993"></th><br /><td align=center bgcolor="#000000"><input type=button value=">>" onClick="IncDecYear(1)"></td></tr><br /><tr><td align=center bgcolor="#000000"><input type=button value="<<" onClick="IncDecMonth(-1)"></td><br /><th bgcolor="#aaaaaa" colspan=5 align=center><input size=9 type=text value=" January "></th><br /><td align=center bgcolor="#000000"><input type=button value=">>" onClick="IncDecMonth(1)"></td></tr><br /><tr><th bgcolor="#ffcccc">Sun</td><br /><th bgcolor="#ccccff">Mon</td><br /><th bgcolor="#ccccff">Tue</td><br /><th bgcolor="#ccccff">Wed</td><br /><th bgcolor="#ccccff">Thu</td><br /><th bgcolor="#ccccff">Fri</td><br /><th bgcolor="#ccccff">Sat</td></tr><br /><tr><td bgcolor="#ffcccc"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td></tr><br /><tr><td bgcolor="#ffcccc"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td></tr><br /><tr><td bgcolor="#ffcccc"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td></tr><br /><tr><td bgcolor="#ffcccc"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td></tr><br /><tr><td bgcolor="#ffcccc"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#ccccff" ><input type=text size=2></td></tr><br /><tr><td bgcolor="#ffcccc"><input type=text size=2></td><br /><td bgcolor="#ccccff"><input type=text size=2></td><br /><td bgcolor="#aaaaaa" colspan=5><input type=text></td></tr><br /></form><br /></table><br /></td></tr></table><br /><script language="Javascript"><br /><!--<br />//include this script segment if you want to set the calendar to today's date.<br />//this MUST come after the tabled form which contains the calendar<br />//set calendar to today's date<br />myDate = new Date();<br />var Month = parseInt(myDate.getMonth());<br />document.calform.elements[1].value = myDate.getYear();<br />document.calform.elements[4].value = PadSpaces(Months[Month]);<br />document.calform.elements[43].value = "Today is: " +<br />myDate.getDate() + " " + Months[Month].substring(0,3)<br />+ ", " + (myDate.getYear());<br />FillCalendar();<br />// --><br /></script><br /> |
|
Crazy&Estudiante
Üye
Yaş : 29
Kayıt tarihi : 21/08/08
Mesaj Sayısı : 40
|
Konu: Geri: Sitene Takvim Ekle Cuma Ağus. 22, 2008 2:29 pm |
|
|
baya karmaşık bişe
iyi ki kopyala yapıştır diye bişey var |
|
Admin
Admin
Yaş : 30
Kayıt tarihi : 05/08/08
Mesaj Sayısı : 206
|
Konu: Geri: Sitene Takvim Ekle Cuma Ağus. 22, 2008 2:33 pm |
|
|
Aynen oda olmasa zaten
|
|