Here you can find a number of examples on Java Script.Please find the various kinds of examples listed on the right side of this site. If you don't find anything on Java Script then please write to us or leave a commnet. We are pleased to help and find the solution of your problem.

JavaScript: VISIT COUNTER

<html>
<head>
<title>VISIT COUNTER</title>
<style>
.counter{
background-color:white;
color:blue;
font-weight:bold;}
</style>

<SCRIPT>
expireDate = new Date
expireDate.setMonth(expireDate.getMonth()+6)
jcount = eval(cookieVal("jaafarCounter"))
jcount++
document.cookie = "jaafarCounter="+jcount+";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_counter(){
for (i=0;i<(7-jcount.toString().length);i++)
document.write('<span class="counter">0</span>')
for (y=0;y<(jcount.toString().length);y++)
document.write('<span class="counter">'+jcount.toString().charAt(y)+'</span>')
}
</SCRIPT>

<SCRIPT>
page_counter(jcount);
</SCRIPT>
</head>
</html>

18 comments:

  1. but in this code counter increass by refresh

    ReplyDelete
  2. but in this code counter increass by refresh

    ReplyDelete
  3. it doesnt work for chrome, only firefox :/

    ReplyDelete
  4. i want to change the value of the increment from 1 to maybe 10? how do i do that?

    ReplyDelete
  5. my firefox browser has 32 visits but when I use a new browser it starts and number 1. How can this show a true count for visits like that.

    ReplyDelete

Google