Prikazi cijelu temu 20.02.2011 00:36
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Predhodna posjeta
PreuzmiIzvorni kôd (Text):
  1. <HTML>
  2. <HEAD>
  3. <META NAME="generator" CONTENT="toniarts easyhtml v.2.4">
  4. <TITLE>Title of your page</TITLE>
  5. <SCRIPT LANGUAGE = "JavaScript">
  6. <!-- Begin Script
  7. var expDays = 30;
  8. var exp = new Date();
  9. exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
  10.  
  11. function When(info){
  12.         // When
  13.                 var rightNow = new Date()
  14.                 var WWHTime = 0;
  15.                 WWHTime = GetCookie('WWhenH')
  16.  
  17.                 WWHTime = WWHTime * 1
  18.  
  19.                 var lastHereFormatting = new Date(WWHTime);  // Date-i-fy that number
  20.                 var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
  21.                 var lastHereInDateFormat = "" + lastHereFormatting;  // Gotta use substring functions
  22.                 var dayOfWeek = lastHereInDateFormat.substring(0,3)
  23.                 var dateMonth = lastHereInDateFormat.substring(4,10)
  24.                 var hours = "" + lastHereFormatting.getHours()
  25.                 var year = lastHereFormatting.getYear()
  26.                 if (year < 1000) year+=1900
  27.                 var minutes = "" + lastHereFormatting.getMinutes()
  28.                 if (minutes.substring(0,1) == minutes){
  29.                         minutes = "0" + minutes
  30.                 }
  31.                 var WWHText = dayOfWeek + ", " + dateMonth + " " + year + " at " +  hours + ":" + minutes// display
  32.  
  33.                 SetCookie ("WWhenH", rightNow.getTime(), exp)
  34.  
  35.         return WWHText;
  36. }
  37.  
  38. function Count(info){
  39.         var psj=0;
  40.         // How many times
  41.                 var WWHCount = GetCookie('WWHCount')
  42.                 if (WWHCount == null) {
  43.                         WWHCount = 0;
  44.                 }
  45.                 else{
  46.                         WWHCount++;
  47.                 }
  48.                 SetCookie ('WWHCount', WWHCount, exp);
  49.  
  50.  
  51.         return WWHCount+1;
  52. }
  53.  
  54.  
  55.  
  56. function set(){
  57. //      VisitorName = prompt("Who are you?", "Nada");
  58. //      SetCookie ('VisitorName', VisitorName, exp);
  59.         SetCookie ('WWHCount', 0, exp);
  60.         SetCookie ('WWhenH', 0, exp);
  61. }
  62.  
  63. function getCookieVal (offset) {
  64.         var endstr = document.cookie.indexOf (";", offset);
  65.         if (endstr == -1)
  66.                 endstr = document.cookie.length;
  67.                 return unescape(document.cookie.substring(offset, endstr));
  68. }
  69.  
  70. function GetCookie (name) {
  71.         var arg = name + "=";
  72.         var alen = arg.length;
  73.         var clen = document.cookie.length;
  74.         var i = 0;
  75.         while (i < clen) {
  76.         var j = i + alen;
  77.         if (document.cookie.substring(i, j) == arg)
  78.                 return getCookieVal (j);
  79.                 i = document.cookie.indexOf(" ", i) + 1;
  80.                 if (i == 0) break;
  81.         }
  82.         return null;
  83. }
  84.  
  85. function SetCookie (name, value) {
  86.         var argv = SetCookie.arguments;
  87.         var argc = SetCookie.arguments.length;
  88.         var expires = (argc > 2) ? argv[2] : null;
  89.         var path = (argc > 3) ? argv[3] : null;
  90.         var domain = (argc > 4) ? argv[4] : null;
  91.         var secure = (argc > 5) ? argv[5] : false;
  92.         document.cookie = name + "=" + escape (value) +
  93.         ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  94.         ((path == null) ? "" : ("; path=" + path)) +
  95.         ((domain == null) ? "" : ("; domain=" + domain)) +
  96.         ((secure == true) ? "; secure" : "");
  97. }
  98.  
  99. function DeleteCookie (name) {
  100.         var exp = new Date();
  101.         exp.setTime (exp.getTime() - 1);
  102.         // This cookie is history
  103.         var cval = GetCookie (name);
  104.         document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
  105.  
  106. }
  107. //  End Script -->
  108. </SCRIPT>
  109.  
  110. </HEAD>
  111. <BODY>
  112. <script>
  113. if (Count()==1){
  114. document.write("Ovo je prva posjeta")
  115. When()
  116. }
  117. else if (Count()>1)
  118. document.write("Zadnja posjeta je bila: <b>" + When() +"</B>.")
  119. </script>
  120.  
  121. </BODY>
  122. </HTML>

Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.