»
AnglaisFran�aisVietnamien

Imprimer - Message de cookie - JavaScriptBank.com

Version compl�te: jsB@nk » Cookie » Message de cookie
URL: https://www.javascriptbank.com/message-with-cookie.html

Message de cookie © JavaScriptBank.comCookie compter combien de fois vous avez visité notre ressource. Avec humour:) Essayez maintenant!

Version compl�te: jsB@nk » Cookie » Message de cookie
URL: https://www.javascriptbank.com/message-with-cookie.html



JavaScript
<SCRIPT language=JavaScript><!-- hide this script tag's contents from old browsers// NUMBER - returns a string in place of a numberfunction number(x) {        if (x==1) return "one"; if (x==2) return "two"; if (x==3) return "three";        if (x==4) return "four"; if (x==5) return "five"; if (x==6) return "six";        if (x==7) return "seven"; if (x==8) return "eight"; if (x==9) return "nine";        if (x==10) return "ten"; if (x==11) return "eleven"; if (x==12) return "twelve";        return x; //default}function ishtime(h,m){        h = number(h)        if (m<=3 || m>57) return h+" o'clock";    if (m<=7)  return "five past "+h;    if (m<=12) return "ten past "+h;    if (m<=17) return "quarter past "+h;    if (m<=23) return "twenty past "+h;    if (m<=28) return "twenty-five past "+h;    if (m<=33) return "half past "+h;    if (m<=38) return "twenty-five to "+h;    if (m<=43) return "twenty to "+h;    if (m<=48) return "quarter to "+h;    if (m<=53) return "ten to "+h;    if (m<=58) return "five to "+h;        return "h:m"; // never reached?}function daytime(h) {        if (!h || h>21) return " at night"        if (h<12) return " in the morning";        if (h<=17) return " in the afternoon";        return " in the evening"; // default}function ish(h,m) {        if (!h && !m) { // if no time supplied, use the system time                time = new Date()                h = time.getHours()                m = time.getMinutes()}        z = daytime(h);        h = h % 12 // fix to 12 hour clock        if (m>57 && time.getSeconds()>30) m++; // round seconds        if (m>60) m=0 // round up minutes        if (m>33) h++ // round up hours    if (h>12)  h = 1 // the clock turns round..    if (h==0) h = 12return "It's now about "+ishtime(h,m)+z+"."}function getCookieVal (offset)   {   var endstr = document.cookie.indexOf (";", offset);   if (endstr == -1)      endstr = document.cookie.length;   return unescape(document.cookie.substring(offset, endstr));   }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 SetCookie (name, value)   {   var argv = SetCookie.arguments;   var argc = SetCookie.arguments.length;   var expires = (2 < argc) ? argv[2] : null;   var path = (3 < argc) ? argv[3] : null;   var domain = (4 < argc) ? argv[4] : null;   var secure = (5 < argc) ? argv[5] : false;   document.cookie = name + "=" + escape (value) +     ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +     ((path == null) ? "" : ("; path=" + path)) +     ((domain == null) ? "" : ("; domain=" + domain)) +        ((secure == true) ? "; secure" : "");   }function ResetCounts(name)   {   visits = 0;   SetCookie("visits", visits, expdate , "/", null, false);   leapto();   }// De-activate Cloaking --></SCRIPT><SCRIPT language=JavaScript><!--HIDE FROM OLD BROWSERS--document.writeln(ish(),"<P>")function greeting(){   var today = new Date();   var hrs = today.getHours();   document.write("<H4>Good ");   if (hrs < 4)   document.write("Morning! - Hey, it's late, go to bed!");   else if (hrs <6)           document.write("Morning! - Wow, you're up early, go back to bed!");   else if (hrs < 12)      document.write("Morning! - Wow, you're up before Midday!");   else if (hrs <= 16)      document.write("Afternoon!");   else      document.write("Evening!");   document.writeln("</H4>");}greeting();<!-- end hiding contents from old browsers  --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<SCRIPT language=JavaScript><!-- Activate Cloakingvar expdate = new Date();var visits;// Set expiration date to a year from now.expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));if(!(visits = GetCookie("visits")))  visits = 0;visits++;SetCookie("visits", visits, expdate, "/", null, false);document.write("<center>"+"I see that you have been to this page "+" "+""+visits+"</FONT>"+" "+"time(s) so far."+"</center>");   if(visits == 1)      document.write("<FONT SIZE=+1><CENTER>"+" Oh, your first time here!"                   +"</CENTER></FONT>");   if(visits == 2)      document.write("<FONT SIZE=+1><CENTER>"+" You've been here already."                   +"</CENTER></FONT>");   if(visits == 3)      document.write("<FONT SIZE=+1><CENTER>"+" A third time!"                          +"</CENTER></FONT>");   if(visits == 4)      document.write("<FONT SIZE=+1><CENTER>"+" That is unbelievable!"                     +"</CENTER></FONT>");   if(visits == 5)      document.write("<FONT SIZE=+1><CENTER>"+" Wow, I must be doing a good job!"         +"</CENTER></FONT>");   if(visits == 6)      document.write("<FONT SIZE=+1><CENTER>"+" All right, All right already!"                         +"</CENTER></FONT>");   if(visits == 7)      document.write("<FONT SIZE=+1><CENTER>"+" Is this the only web page you go to?"                     +"</CENTER></FONT>");   if(visits== 8)      document.write("<FONT SIZE=+1><CENTER>"+" If you're here this often you can start paying rent!"                   +"</CENTER></FONT>");   if(visits== 9)      document.write("<FONT SIZE=+1><CENTER>"+" Do you ever sleep?"                                 +"</CENTER></FONT>");   if(visits==10)      document.write("<FONT SIZE=+1><CENTER>"+" I can't believe you keep coming back!" +"</CENTER></FONT>");   if(visits==12)      document.write("<P><FONT SIZE=+1><CENTER>"+" Don't you have something better to do?"+"</CENTER></FONT>");   if(visits==69)      document.write("<p><FONT SIZE=+1><CENTER>"+" I think you are stalking me... Better call the cyber-cops... "    +"</CENTER></FONT>");   if(visits==98)      document.write("<p><FONT SIZE=+1><CENTER>"+" Does anybody see this ?!?"+"</CENTER></FONT>");   if(visits>=99)      document.write("<p><FONT SIZE=+1><CENTER>"+"You are really starting to scare me! Is my site that good?" +"</CENTER></FONT>");// De-activate Cloaking --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->