Personal Count Total Visited Using HTML JavaScript
Submitted by alpha_luna on Wednesday, June 3, 2015 - 23:54.
Personal Count Total Visited tallies and displays the number of visitors by the current page. It will use cookies to accomplish this task. The number of visitors in your site will be counted automatically through this script. You will know the number of people who visits your site.
Count Total Visited
You have visited this page times.
(Reload page to see it works)
Second: Where you want the Personal Count Total Visited appear in your page, kindly insert this script.
Example:
Directions:
First: Kindly add the code below to the HEAD section of your page.- <style type="text/css">
- .counter_style {
- background-color:black;
- color:cyan;
- font-weight:bold;
- }
- p {
- font-size:18px;
- font-weight:bold;
- {
- </style>
- <script type="text/javascript" lang="Eng">
- expireDate = new Date
- expireDate.setMonth(expireDate.getMonth()+6)
- count_num = eval(cookieVal("counter_style_Visited"))
- count_num++
- document.cookie = "counter_style_Visited="+count_num+";expires=" + expireDate.toGMTString()
- function cookieVal(cookieName) {
- thisCookie = document.cookie.split("; ")
- for (i=0; i<thisCookie.length; i++){
- if (cookieName == thisCookie[i].split("=")[0]){
- return thisCookie[i].split("=")[1]
- }
- }
- return 0
- }
- function page_countvisit(){
- for (i=0;i<(7-count_num.toString().length);i++)
- document.write('<span class="counter_style">0</span>')
- for (y=0;y<(count_num.toString().length);y++)
- document.write('<span class="counter_style">'+count_num.toString().charAt(y)+'</span>')
- }
- </script>
You have visited this page <script type="text/javascript" lang="Eng">page_countvisit(count_num);</script> times.
Add new comment
- 89 views