Use jquery scripts to get statistics on essays, articles, and comments, customize display locations

Source: Internet
Author: User

For this problem, spent a lot of time to grope, helpless did not fix. So, I went to Bo asked to ask questions, finally fix!

Thank you very much for Seayxu's helpful help here.

1. Add a label in the desired location
<div id="stats_count_show"></div>
2. Add JS code to the homepage HTML page
<script type="Text/javascript">$ (function () {setTimeout (Getallcount, the); function Getallcount () {varPost = document.getElementById ('Stats_post_count'). Innertext.replace (/.*? ( \d+). *?/g,' $'); varArticle = document.getElementById ('Stats_article_count'). Innertext.replace (/.*? ( \d+). *?/g,' $'); varComment = document.getElementById ('Stats-comment_count'). Innertext.replace (/.*? ( \d+). *?/g,' $'); Post= post! =NULL|| Post! =""? Post:0; Article= Article! =NULL|| Article! =""? Article:0; Comment= comment! =NULL|| Comment! =""? Comment:0; document.getElementById ('Stats_count_show'). InnerText ="Essays-"+ post +"article-"+ Article +"Reviews-"+ Comment +"\ n";}});</script>
3. Display effect

Use jquery scripts to get statistics on essays, articles, and comments, customize display locations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.