Tutorial : Nota Selamat Datang Di Blog

WRITTEN BY : ARRIF TIME : 12:22 PM TOTAL COMMENTS : 0


Assalamualaikum dan salam sejahtera semua.

Harini aku nak ajar kauorang lagi satuu tutorial yang best dan senang nak buat. Bagi blogger baru tu yang nak cuba buat benda ni boleh lah try okay? Kali ni aku nak tunjuk macamana nak buat nota selamat datang atau pembuka kata lah senangnya ye. Fungsinya untuk bagitahu pembaca yang mereka dah pernah datang blog ke ke belum, kalau dah, berapa kali dan bila kali terakhir mereka datang blog kita. Macam dalam gambar bawah ni. 


Jadi kita mulakan.

1. Pergi 'Dashboard'
2. a. Untuk blogger yang guna 'Blogger Old Interface' : Buka ruangan 'Design' ==> 'Add Page Element'
    b. Untuk blogger yang guna 'Blogger New Interface' : Buka ruangan 'Layout' ==> 'Add a Gadget'
3. Pilih element/gadget 'HTML/Javascript'

4. Copy kod dekat bawah ni :

<div class="widget"><h4></h4> <div class="textwidget"><p style="text-align: justify;"><script type="text/javascript">
/***********************************************
* Display time of last visit script- by JavaScriptKit.com
* This notice MUST stay intact for use
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
***********************************************/
var days = 730; // days until cookie expires = 2 years.
var lastvisit=new Object();
var firstvisitmsg="Selamat Datang! Ini adalah kunjungan anda yang pertama di blog ini.";
lastvisit.subsequentvisitmsg="Terima kasih kerana sudi melawat blog ini. Kunjungan terakhir anda pada <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("Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat");
var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
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 + ":" + secs + " " + ampm
document.write(lastvisit.subsequentvisitmsg.replace("\[displaydate\]", dispDate))
}
lastvisit.setCookie("visitc", wh, days);
}
lastvisit.showmessage();

</script><br />
<script>
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 = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? 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 DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
</script>
<script>
document.write("Anda pernah singgah di blog AREP SKEMA  sebanyak <b>" + amt() + "</b> kali. Terima kasih. Sila datang lagi okay?.")
</script></p>
</div></div>


5. Dah Copy kan? Paste kan kod tu dekat bahagian 'HTML/Javascript' tadi.

PENGUBAHSUAIAN :
- Tukar ayat yang aku warnakan merah tu dengan ayat kauorang sendiri okay?

7. Tekan lah  button 'Save' dan lihat hasilnya dekat blog kauorang.



Sila bagitahu kalau menjadi dan bagitahu juga kalau tak menjadi. ;)



Related Posts Plugin for WordPress, Blogger...

No comments:

Post a Comment

Dah baca kan? Komen lah sikit. Sikit pun jadilah.
Fikir sebelum menaip. ;)