Thứ Ba, 5 tháng 12, 2017

XEM BÀI VIÊT
TOÀN MÀN HÌNH

Tổng hợp code đếm số lượng trong Blogger (Blogspot)

1. Hiển thị tổng số bài viết của blog
<script style="text/javascript">
function showpostcount(json) {
document.write('<left>Tổng số bài viết: <b>' + parseInt(json.feed.openSearch$totalResults.$t,10)
+ '</b></center>');}</script>
<script src="http://www.chiase78.blogspot.com/feeds/posts/default?alt=json-in-script&callback=showpostcount"></script>

2. Hiển thị tổng số bình luận của blog
<script style="text/javascript">
function numberOfComments(json) {
document.write('<left>Tổng số bình luận: <b>' + json.feed.openSearch$totalResults.$t +
'</b></center>');}</script>
<script src="http://www.chiase78.blogspot.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script>

3. Hiển thị tổng số trang tĩnh (Page) của blog
<script style="text/javascript">
function numberOfPages(json) {
document.write('<left>Tổng số trang tĩnh: <b>' + json.feed.openSearch$totalResults.$t +
'</b></center>');}</script>
<script src="http://www.chiase78.blogspot.com/feeds/pages/default?alt=json-in-script&callback=numberOfPages"></script>

4. Hiển thị tổng số bài viết của một nhãn (Label) bất kì
<script style="text/javascript">
function numberOfLabelPosts(json) {
document.write('<left>Tổng số bài viết của nhãn: <b>' + json.feed.openSearch$totalResults.$t +
'</b></center>');}</script>
<script src="http://www.chiase78.blogspot.com/feeds/posts/default/-/Thủ Thuật Blogger?alt=json-in-script&callback=numberOfLabelPosts"></script>

Để code hoạt động, các bạn có thể chèn vào một vị trí nào đó trong template hoặc truy cập Thử mã JavaScript để xem kết quả.

Thay http://www.chiase78.blogspot.com bằng địa chỉ blog bạn muốn hiển thị
Thay Thủ Thuật Blogger bằng nhãn bạn muốn hiển thị
- Trong quá trình viết bài chúng tôi sẽ có nhiều thiếu sót mong các bạn đóng góp để chúng tôi rút kinh nghiệm hơn !
- Mọi chi tiết xin liên hệ:
- Email: lephuocsinh96@gmail.com
- Facebook: Fb.com/beohoavinh

0 nhận xét:

Ads by Google