• Ingin cantikkan blog?? Design blog secara PERCUMA..Grab cepat sebelum terlambat
  • Ingin cantikkan blog?? Design blog secara PERCUMA..Grab cepat sebelum terlambat
  • Ingin cantikkan blog?? Design blog secara PERCUMA..Grab cepat sebelum terlambat
  • Ingin cantikkan blog?? Design blog secara PERCUMA..Grab cepat sebelum terlambat

Label Cloud

Search This Blog

07 March 2010

online counter Resent Post Yang Cool

Assamualaikum ,Pagi nie Msue nak kongsi lagi ngan korang sume memasang resent post yang cool pada sidebar blog korang .Sebelu nie Msue ade perkenalkan pada korang memasang resent post slider






1. Login ke Blogspot .

2. Klik Layout - Add a Gadget - HTML / Javascript

3. Copy kod dibawah


<div id="newPosts">
<noscript>failed!<br/>Javascript not supported here!</noscript>
</div>

<script>
var nPostStartIndex = 6;
var nPostShow = 5;

function showRecentPosts(nIndex) {
if (!nIndex)
nIndex = nPostStartIndex;
var sFeedURL = 'http://www.msueroomz.blogspot.com/feeds/posts/summary?orderby=published&start-index='+nIndex+'&max-results='+(nPostShow+1)+'&alt=json-in-script&callback=generatePosts';
var script = document.createElement('script');
document.getElementById('newPosts').innerHTML = 'Loading..';
script.setAttribute('src', sFeedURL);
script.setAttribute('type', 'text/javascript');
document.documentElement.firstChild.appendChild(script);
}

function generatePosts(json) {
function compareentry(a,b) {
order= Date.parse(a.published.$t.replace(/^(\d{4})-(\d{2})-(\d{2})T([0-9:]*)([.0-9]*)(.)(.*)$/, '$1/$2/$3 $4 GMT')) - Date.parse(b.published.$t.replace(/^(\d{4})-(\d{2})-(\d{2})T([0-9:]*)([.0-9]*)(.)(.*)$/, '$1/$2/$3 $4 GMT'));
return 0-order;
}
var sHTML = '<ul>';
var sortentry = json.feed.entry.sort(compareentry);
var nIndex = parseInt(json.feed.openSearch$startIndex.$t);
var nTotalPost = parseInt(json.feed.openSearch$totalResults.$t);
for (var i = 0, Post; Post = sortentry[i]; i++) {
if (i >= nPostShow)
break;
var title = Post.title.$t;
var j = 0;
while (j < Post.link.length && Post.link[j].rel != "alternate")
j++;
var link = Post.link[j].href;
var timestamp=Post.published.$t.substr(0,10);
sHTML += '<li><span class="item-title"><a href="'+link+'">'+ title +'</a></span></li>';
}
sHTML += '</ul>';
sHTML += generatePostLink(parseInt(json.feed.entry.length), nIndex, nTotalPost);
document.getElementById('newPosts').innerHTML = sHTML;
}

function generatePostLink(nFetch, nIndex, nTotalPost) {
var bOld = (nFetch > nPostShow);
if (bOld) nFetch = nPostShow;
var sResult = '<p align="right">';
if (nIndex > nPostStartIndex)
sResult += '<a href="javascript:showRecentPosts('+(nIndex-nPostShow)+');" title="Newer Posts"><<</a>&nbsp;&nbsp;';
if (bOld)
sResult += '<a href="javascript:showRecentPosts('+(nIndex+nPostShow)+');" title="Older Posts">>></a>';
sResult += '</p>';
return sResult;
}
</script>

<script language="javascript">showRecentPosts();</script>



4. Pastekan didalamnya .

5. Save dan Preview .:okay:yahoo


Note : Pada highlight merah korang tukarkan ngan URL blog korang , highlight biru entri yang dipaparkan bermula daripada entri yang ke berapa Contoh ada pada image dibawah ) . Highlight hijau jumlah entry baru yang terlepas ingin dipaparkan pada resnt post .






Via - JejakTrend





Tinggalkan Komen Anda Disini