Membuat data kunjungan terakhir

Oke tau gak maksud postingan ane kali ini yang berjudul membuat data kunjungan terakhir .. kalo gak ane jelasin, kalo udah tau langsung aja..oh belum tau ya...
oke dah maksunya ente bisa data data kapan ente terakhir ke blog suatu blog.. untuk DEMO nya silah kan refresh halaman ini dan lihat perbedaan di kotak berikut 




Gimana... mantep gak... kalo hau buat berikut caranya.... Cekidot... Loggin Blogger Rancangan, Tambahkan Gadget. html/javascript Copy code berikut
<script type = "text/javascript"> var days = 730; // days until cookie expires = 2 years. var lastvisit=new Object(); var firstvisitmsg="<i>Selamat Datang! :D</i>"; lastvisit.subsequentvisitmsg="<i>Selamat Datang Lagi! Terakhir Datang Hari</i> <b>[displaydate]</b>"; lastvisit.getCookie=function(Name){ var re=new RegExp(Name+"=[^;]+", "i"); if (document.cookie.match(re)) return document.cookie.match(re)[0].split("=")[1]; return''; } lastvisit.setCookie=function(name, value, days){ var expireDate = new Date(); var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days)); document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/"; } lastvisit.showmessage = function() { var wh = new Date(); if (lastvisit.getCookie("visitc") == "") { lastvisit.setCookie("visitc", wh, days); document.write(firstvisitmsg); } else { var lv = lastvisit.getCookie("visitc"); var lvp = Date.parse(lv); var now = new Date(); now.setTime(lvp); var day = new Array("Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"); var month = new Array ("Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "Desember"); var dd = now.getDate(); var dy = now.getDay(); dy = day[dy]; var mn = now.getMonth(); mn = month[mn]; yy = now.getFullYear(); var hh = now.getHours(); var ampm = "AM"; if (hh >= 12) {ampm = "PM"} if (hh >12){hh = hh - 12}; if (hh == 0) {hh = 12} if (hh < 10) {hh = "0" + hh}; var mins = now.getMinutes(); if (mins < 10) {mins = "0"+ mins} var secs = now.getSeconds(); if (secs < 10) {secs = "0" + secs} var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " + hh + ":" + mins + " " + ampm document.write(lastvisit.subsequentvisitmsg.replace("[displaydate]", dispDate)) } lastvisit.setCookie("visitc", wh, days); } lastvisit.showmessage(); </script>
Simpan deh  Source : http://farixsantips.blogspot.com

Bagikan Artikel Ini ke: Facebook Twitter Google+ Linkedin Technorati Digg
Posted by Jasriman Sukri, Published at 22.38 and have 3 komentar

3 komentar:

  1. Keren sob. Tapi sayangnya ful js ya? takut berat kalo dipasang tempat ane, gimana menurut sobat?

    BalasHapus
  2. @Suhendri Mrberkata...
    iya sih sebenernya...heehhee

    BalasHapus