Duyuruyu Kapat
Facebook Gözat
Twitter Gözat

Javascript kaynak kod

Konu, 'Genel Webmaster Konuları' kısmında yemre tarafından paylaşıldı.

  1. yemre

    yemre Daimi Üye

    Kayıt:
    27 Mayıs 2002
    Mesajlar:
    2,180
    Beğenilen Mesajlar:
    0
    Meslek:
    Uygulama Geliştirme
    Şehir:
    İstanbul
    Javascript kaynak kod Tarih Scripti

    hoş bir javascirpt bana ait değil ama dursun burada ...... free kullanım belki benim gibi web tabanlı programlama diline alışamayanlar vardır onların işine yarar.....

    tarih scripti......

    <script language="JavaScript">

    <!-- for sucky browsers
    Months = new Array(12);
    Months[0] = "Ocak";
    Months[1] = "Şubat";
    Months[2] = "Mart";
    Months[3] = "Nisan";
    Months[4] = "Mayıs";
    Months[5] = "Haziran";
    Months[6] = "Temmuz";
    Months[7] = "Ağustos";
    Months[8] = "Eylül";
    Months[9] = "Ekim";
    Months[10] = "Kasım";
    Months[11] = "Aralık";
    function PadSpaces(TheString)
    {
    var Spaces = " ";
    len = Math.round((9 - TheString.length)/2);
    return Spaces.substring(0,len) + TheString;
    }
    function NumLeapYears(StartYear, EndYear)
    {
    var LeapYears, i;
    if (EndYear >= StartYear){
    for(LeapYears = 0; StartYear <= EndYear; StartYear++)
    if (IsLeapYear(StartYear)) LeapYears++;
    }else{
    for(LeapYears = 0; EndYear <= StartYear; EndYear++)
    if (IsLeapYear(EndYear)) LeapYears++;
    }
    return LeapYears;
    }
    function IsLeapYear(Year)
    {
    if(Math.round(Year/4) == Year/4){
    if(Math.round(Year/100) == Year/100){
    if(Math.round(Year/400) == Year/400)
    return true;
    else return false;
    }else return true;
    }
    return false;
    }
    function Trim(TheString)
    {
    var len;
    len = TheString.length;
    while(TheString.substring(0,1) == " "){ //trim left
    TheString = TheString.substring(1, len);
    len = TheString.length;
    }
    while(TheString.substring(len-1, len) == " "){ //trim right
    TheString = TheString.substring(0, len-1);
    len = TheString.length;
    }
    return TheString;
    }
    function DetermineMonthIdx()
    {
    var i, month, month_s, len;
    month = Trim(document.calform.elements[4].value);
    len = month.length;
    for( i = 0; i <12; i++){
    month_s = Months.substring(0,len);
    if (month_s.toUpperCase() == month.toUpperCase())
    return (i);
    }
    return -1;
    }
    function FindNewYearStartingDay(Year)
    {
    var LeapYears, Years, Day;
    LeapYears = NumLeapYears(1995, Year);
    if (Year >=1995)
    Years = (Year -1995)+LeapYears;
    else Years = (Year -1995)-LeapYears;
    if (Year >=1995)
    Day = Math.round(((Years/7 - Math.floor(Years/7))*7)+.1);
    else Day = Math.round(((Years/7 - Math.ceil(Years/7))*7)-.1);
    if (Year >=1995){
    if(IsLeapYear(Year)) Day--;
    }else Day += 7;
    if(Day < 0) Day = 6;
    if(Day > 6) Day = 0;
    return Day;
    }
    function FindNumDaysInMonth(Year, Month)
    {
    if(Month == 1){
    if(IsLeapYear(Year)) return 29;
    else return 28;
    }else{
    if(Month >6) Month++;
    if(Month/2 == Math.round(Month/2)) return 31;
    }
    return 30;
    }
    function FindMonthStartDay(NewYearDay, Year, Month)
    {
    var MonthStartDay;
    AddArray = new Array(12);
    AddArray[0]=0;AddArray[1]=3;AddArray[2]=3;AddArray[3]=6;
    AddArray[4]=1;AddArray[5]=4;AddArray[6]=6;AddArray[7]=2;
    AddArray[8]=5;AddArray[9]=0;AddArray[10]=3;AddArray[11]=5;
    MonthStartDay = NewYearDay + AddArray[Month];
    if(IsLeapYear(Year) && (Month ) > 1) MonthStartDay ++;
    if (MonthStartDay > 6) MonthStartDay -= 7;
    return MonthStartDay;
    }
    function FillCalendar()
    {
    var Year, Month, Midx, NewYearDay, MonthStartDay;
    var NumDaysInMonth, i, t;
    Year = parseFloat(document.calform.elements[1].value);
    Month = document.calform.elements[4].value;
    Midx = DetermineMonthIdx();
    if (Midx == -1){
    alert ("Can't recognize that month");
    return;
    }
    NewYearDay = FindNewYearStartingDay(Year);
    MonthStartDay = FindMonthStartDay(NewYearDay, Year, Midx);
    NumDaysInMonth = FindNumDaysInMonth(Year, Midx);
    for(i = 6; i < 43; i++){
    t = i-5-MonthStartDay;
    if ( t >= 1 && t <= NumDaysInMonth)
    document.calform.elements.value =t;
    else document.calform.elements.value = "";
    }
    }
    function IncDecYear(val)
    {
    var valNum = parseInt(val);
    var valNum2 = parseInt(document.calform.elements[1].value)
    document.calform.elements[1].value = valNum2 + valNum;
    FillCalendar()
    }
    function IncDecMonth(val)
    {
    var valNum = parseInt(val);
    var Midx = DetermineMonthIdx();
    Midx += valNum;
    if(Midx > 11) Midx = 0;
    if(Midx < 0) Midx = 11;
    document.calform.elements[4].value = PadSpaces(Months[Midx]);
    FillCalendar()
    }
    // -->
    </script>

    <table border=1 bgcolor="#000000"><tr><td align=center>
    <table border=0 cellspacing=0 align=center>
    <form name="calform" align=center>
    <tr><td align=center bgcolor="#000000"><input type=button value="<<" onClick="IncDecYear(-1)"></td>
    <th bgcolor="#aaaaaa" colspan=5 align=center><input size=4 type=text value="1993"></th>
    <td align=center bgcolor="#000000"><input type=button value=">>" onClick="IncDecYear(1)"></td></tr>
    <tr><td align=center bgcolor="#000000"><input type=button value="<<" onClick="IncDecMonth(-1)"></td>
    <th bgcolor="#aaaaaa" colspan=5 align=center><input size=9 type=text value=" January "></th>
    <td align=center bgcolor="#000000"><input type=button value=">>" onClick="IncDecMonth(1)"></td></tr>
    <tr><th bgcolor="#ffcccc">Paz</td>
    <th bgcolor="#ccccff">Pzt</td>
    <th bgcolor="#ccccff">Sal</td>
    <th bgcolor="#ccccff">Çar</td>
    <th bgcolor="#ccccff">Per</td>
    <th bgcolor="#ccccff">Cum</td>
    <th bgcolor="#ccccff">Cmt</td></tr>
    <tr><td bgcolor="#ffcccc"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td></tr>
    <tr><td bgcolor="#ffcccc"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td></tr>
    <tr><td bgcolor="#ffcccc"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td></tr>
    <tr><td bgcolor="#ffcccc"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td></tr>
    <tr><td bgcolor="#ffcccc"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#ccccff" ><input type=text size=2></td></tr>
    <tr><td bgcolor="#ffcccc"><input type=text size=2></td>
    <td bgcolor="#ccccff"><input type=text size=2></td>
    <td bgcolor="#aaaaaa" colspan=5><input type=text></td></tr>
    </form>
    </table>


    <script language="JavaScript">
    <!--
    //include this script segment if you want to set the calendar to today's date.
    //this MUST come after the tabled form which contains the calendar
    //set calendar to today's date
    myDate = new Date();
    var Month = parseInt(myDate.getMonth());
    document.calform.elements[1].value = myDate.getYear();
    document.calform.elements[4].value = PadSpaces(Months[Month]);
    document.calform.elements[43].value = "Bugün: " +
    myDate.getDate() + " " + Months[Month].substring(0,3)
    + ", " + (myDate.getYear());
    FillCalendar();
    // -->
    </script>
     
    Son düzenleme yönetici tarafından yapıldı: 12 Ağustos 2002
  2. Sahin

    Sahin Daimi Üye

    Kayıt:
    28 Mayıs 2002
    Mesajlar:
    8,943
    Beğenilen Mesajlar:
    0
    Tarih scripti demişsin ama biraz daha açıklama rica etsek kardeş... Nasıl bir işlevi var?
     
  3. yemre

    yemre Daimi Üye

    Kayıt:
    27 Mayıs 2002
    Mesajlar:
    2,180
    Beğenilen Mesajlar:
    0
    Meslek:
    Uygulama Geliştirme
    Şehir:
    İstanbul
    günün tarihini ve gününü yazıyor ve massa üstü takvimi gibi bulunduğunuz yılın ve ayın tam takvimini veriyor ayrıca aylar ve yıllar arasında kolay geçiş sağlıyor