переход на Главную страницу...


Cкачать Java скрипты
(1-100)

01   02   03   04   05  
06   07   08   09   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  

бесплатные шаблоны
javascript для html


Java скрипт - Календарь - напоминатель

Содержимое этой таблицы поместите между <BODY> и </BODY>

 

<!--ЭТО НЕ ОБЯЗАТЕЛЬНО-->
<style>
a:link, a:visited, a:active { text-decoration: none; color: white;}
a:hover { text-decoration: none; color: lime; }
</style>



<SCRIPT LANGUAGE="JavaScript">


<!-- to hide script contents from old browsers

//

// Cookie Functions

// Written by: Bill Dortch, hIdaho Design

// The following functions are released to the public domain.

//

//

// "Internal" function to encode cookie value. This permits cookies to

// contain whitespace, comma and semicolon characters.

//

function encode (str) {

var dest = "";

var len = str.length;

var index = 0;

var code = null;

for (var i = 0; i < len; i++) {

var ch = str.charAt(i);

if (ch == " ") code = "%20";

else if (ch == "%") code = "%25";

else if (ch == ",") code = "%2C";

else if (ch == ";") code = "%3B";

else if (ch == "\b") code = "%08";

else if (ch == "\t") code = "%09";

else if (ch == "\n") code = "%0A";

else if (ch == "\f") code = "%0C";

else if (ch == "\r") code = "%0D";

if (code != null) {

dest += str.substring(index,i) + code;

index = i + 1;

code = null;

}

}

if (index < len)

dest += str.substring(index, len);

return dest;

}



//

// "Internal" function to decode cookie values.

//

function decode (str) {

var dest = "";

var len = str.length;

var index = 0;

var code = null;

var i = 0;

while (i < len) {

i = str.indexOf ("%", i);

if (i == -1)

break;

if (index < i)

dest += str.substring(index, i);

code = str.substring (i+1,i+3);

i += 3;

index = i;

if (code == "20") dest += " ";

else if (code == "25") dest += "%";

else if (code == "2C") dest += ",";

else if (code == "3B") dest += ";"; 

else if (code == "08") dest += "\b";

else if (code == "09") dest += "\t";

else if (code == "0A") dest += "\n";

else if (code == "0C") dest += "\f";

else if (code == "0D") dest += "\r";

else {

i -= 2;

index -= 3;

}



if (index < len)

dest += str.substring(index, len);

return dest;

}



//

// "Internal" function to return the decoded value of a cookie

//

function getCookieVal (offset) {

var endstr = document.cookie.indexOf (";", offset);

if (endstr == -1)

endstr = document.cookie.length;

return decode(document.cookie.substring(offset, endstr));

}



//

// Function to return the value of the cookie specified by "name".

// name - String object containing the cookie name.

//

function GetCookie (name) {

var arg = name + "=";

var alen = arg.length;

var clen = document.cookie.length;

var i = 0;

while (i < clen) {

var j = i + alen;

if (document.cookie.substring(i, j) == arg)

return getCookieVal (j);

i = document.cookie.indexOf(" ", i) + 1;

if (i == 0) break; 

}

return null;

}



//

// Function to create or update a cookie.

// name - String object object containing the cookie name

// value - String object containing the cookie value. May contain

// any valid sting characters, including whitespace, commas and quotes.

// expires - Date object containing the expiration data of the cookie,

// or null to expire the cookie at the end of the current session.

//

function SetCookie (name, value, expires) {

document.cookie = name + "=" + encode(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString()));

}



// Function to delete a cookie. (Sets expiration date to current date/time)

// name - String object containing the cookie name

//

function DeleteCookie (name) {

var exp = new Date();

var cval = GetCookie (name);

document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}
//

// Example

//



function intro()

{

document.write ("<CENTER>");

document.writeln("<BR>");

document.write ("<H1>");

document.write ("Reminder Calendar");

document.writeln("</H1>");

document.writeln("</CENTER>");

document.writeln("<h2>How to use the Reminder Calendar:</h2>");

document.writeln("<ul><li>Click on a date to add a reminder");

document.writeln(" <li>Click on that date again to see the reminder");

document.writeln(" <li>Reload the page to see dates with reminders in different colors");

document.writeln("</ul>");

document.writeln("<h2>Notes:</h2>");

document.writeln("<ul><li>Lame user interface");

document.writeln(" <li>Can't delete a reminder");

document.writeln(" <li>Reminders disappear in about 24 hours");

document.writeln("</ul>");

document.writeln("<h2>This is mostly a programming example of:</h2>");

document.writeln("<ul><li>Using cookies in JavaScript");

document.writeln(" <li>Using text links to call a function, not open a URL");

document.writeln("</ul>");

document.writeln("<h2>Credits:</h2>");

document.writeln("<ul><li>Cookie Functions written by: <A href='mailto:bdortch@netw.com'>Bill Dortch</A>, hIdaho Design");

document.writeln("<ul>The functions are at:");

document.writeln(" <li>Code: <A href='http://www.hidaho.com/cookies/cookie.txt'>  http://www.hidaho.com/cookies/cookie.txt</A>");

document.writeln(" <li>Demo: <A href='http://www.hidaho.com/cookies/cookie.html'> http://www.hidaho.com/cookies/cookie.html</A>");

document.writeln("</ul>");

document.writeln(" <li>Reminder Calendar by James Thiele who can be reached:");

document.writeln(" <UL><LI>at his home page ");

document.writeln(" <A href='http://www.eskimo.com/~jet'>  http://www.eskimo.com/~jet</A>");

document.writeln(" <LI> via email at ");

document.writeln(" <address><A href='mailto:jet@eskimo.com'>   jet@eskimo.com</a></address></p>");

document.writeln("</ul>");

}



function arrayOfDaysInMonths(isLeapYear)

{

this[0] = 31;

this[1] = 28;

if (isLeapYear)

this[1] = 29;

this[2] = 31;

this[3] = 30;

this[4] = 31;

this[5] = 30;

this[6] = 31;

this[7] = 31;

this[8] = 30;

this[9] = 31;

this[10] = 30;

this[11] = 31;

}

function daysInMonth(month, year)

{

// do the classic leap year calculation

var isLeapYear = (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0));

var monthDays = new arrayOfDaysInMonths(isLeapYear);

return monthDays[month];

}

function calendar()

{

var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";

var today = new Date();

var day = today.getDate();

var month = today.getMonth();

var year = today.getYear();

// figure out how many days this month will have...

var numDays = daysInMonth(month, year);

// and go back to the first day of the month...

var firstDay = today;

firstDay.setDate(1);

// and figure out which day of the week it hits...

var startDay = firstDay.getDay();

var column = 0;

// Start the calendar table 

document.write("<CENTER>");

document.write("<TABLE BGCOLOR=GRAY BORDER>");

document.write("<TR><TH COLSPAN=7><FONT COLOR=LIGHTBLUE>");

document.write(monthNames.substring(3*month, 3*(month + 1)) + " " + year);

document.write("<TR><TH><FONT COLOR=LIGHTBLUE>Вс.<TH><FONT COLOR=LIGHTBLUE>Пн.<TH><FONT COLOR=LIGHTBLUE>Вт.<TH><FONT COLOR=LIGHTBLUE>Ср.<TH><FONT COLOR=LIGHTBLUE>Чт.<TH><FONT COLOR=LIGHTBLUE>Пт.<TH><FONT COLOR=LIGHTBLUE>Сб.");

// put blank table entries for days of week before beginning of the month

document.write("<TR>");

for (i=1; i < startDay; i++)

{

document.write("<TD>");

column++;

}

for (i=1; i <= numDays; i++)

{

// Write the day

var s = "" + i;

if ((GetCookie("d"+i) != null))

// s = s.fontcolor(document.vlinkColor);

s = s.fontcolor("#FF0000");

s = s.link("javascript:dayClick(" + i + ")")

document.write("<TD>" + s);



// Check for end of week/row

if (++column == 7)

{

document.write("<TR>"); // start a new row

column = 0;

}

}

document.write("</TABLE>");

document.writeln("</CENTER>");

}



////////////////////////////

//////// dayClick //////////

////////////////////////////

function dayClick(day)

{

var expdate = new Date ();

expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); // 24 hrs from now

var prefix = "d";

var theCookieName = prefix + day;

var theDayclickedReminder = GetCookie(theCookieName);

if (theDayclickedReminder != null) {

alert("На " + day + " число Вы оставили себе следующее сообщение " + theDayclickedReminder);

} // end if

if (confirm("Вы хотите оставить себе сообщение на " + day + " число этого месяца?"))

{

x = prompt("Введите сообщение для напоминания "+ day + " числа этого месяца", theDayclickedReminder);

SetCookie (theCookieName, x, expdate);

} // end if

}



// --> <!-- end hiding contents from old browsers -->


</SCRIPT><p>

<SCRIPT LANGUAGE="JavaScript">



<!-- to hide script contents from old browsers

calendar();

document.write("<HR>");

intro();
// --> <!-- end hiding contents from old browsers -->


</SCRIPT>




      
Cкачать Java скрипты
(101-200)

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  

скачать шаблоны
java script для html
  Книги   Скрипты     Анекдоты   Web Мастеру