使用jquery脚本获取随笔、文章和评论的统计数,自定义显示位置
生活随笔
收集整理的這篇文章主要介紹了
使用jquery脚本获取随笔、文章和评论的统计数,自定义显示位置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為了這個問題,花了好些時間去摸索,無奈沒有搞定。于是,我就到博問去提問,終于搞定!
在此,非常感謝SeayXu的熱心幫助。
1、在需要的位置添加一個標簽
<div id="stats_count_show"></div>2、首頁html頁面添加js代碼
<script type="text/javascript"> $(function() { setTimeout(getAllCount, 3000);function getAllCount() {var post = document.getElementById('stats_post_count').innerText.replace(/.*?(\d+).*?/g, '$1');var article = document.getElementById('stats_article_count').innerText.replace(/.*?(\d+).*?/g, '$1');var comment = document.getElementById('stats-comment_count').innerText.replace(/.*?(\d+).*?/g, '$1');post = post != null || post != "" ? post : 0;article = article != null || article != "" ? article : 0;comment = comment != null || comment != "" ? comment : 0;document.getElementById('stats_count_show').innerText = "隨筆 - " + post + " 文章 - " + article + " 評論 - " + comment + "\n"; } }); </script>3、顯示效果
轉載于:https://www.cnblogs.com/dinphy/p/5877023.html
總結
以上是生活随笔為你收集整理的使用jquery脚本获取随笔、文章和评论的统计数,自定义显示位置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ubuntu问题解答集锦
- 下一篇: python:how does subc