<form method="get" action="/search">
<div class="searchform">
<input type="hidden" name="amount" value="0" />
<input type="hidden" name="blogid" value="1" />
<input name="query" alt="Keywords to search" class="formfield"
size="10" maxlength="60" accesskey="4" value="" />
<input type="submit" alt="Search" value="Search" class="formbutton" />
</div>
</form>
Code to display recent comments :
<ul><script style="text/javascript">
function showrecentcomments(json) {
for (var i = 0; i < 5; i++) {
var entry = json.feed.entry[i];
var ctlink;
if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
ctlink = entry.link[k].href;
break;
}
}
ctlink = ctlink.replace("#", "#comment-");
var ptlink = ctlink.split("#");
ptlink = ptlink[0];
var txtlink = ptlink.split("/");
txtlink = txtlink[5];
txtlink = txtlink.split(".html");
txtlink = txtlink[0];
var pttitle = txtlink.replace(/-/g," ");
pttitle = pttitle.link(ptlink);
if ("content" in entry) {
var comment = entry.content.$t;}
else
if ("summary" in entry) {
var comment = entry.summary.$t;}
else var comment = "";
var re = /<\S[^>]*>/g;
comment = comment.replace(re, "");
document.write('<li>');
document.write('<a href="' + ctlink + '"><strong>' + entry.author[0].name.$t + '</strong></a>, ');
if (comment.length < 100) {
document.write(comment);
}
else
{
comment = comment.substring(0, 100);
var quoteEnd = comment.lastIndexOf(" ");
comment = comment.substring(0, quoteEnd);
document.write(comment + '');
}
}
document.write('</li>');
}
</script>
<script src="http://simpledinamis.blogspot.com/feeds/comments/default?alt=
json-in-script&callback=showrecentcomments">
</script></ul>
Note : Ganti tulisan yang berwarna biru dengan alamat blog anda,
1 komentar:
Mantab, terima kasih sudah berbagi
Posting Komentar