I have the following code
<html>
<head>
<script>
var m=0;
function add() {
m++;
}
</script>
</head>
<body>
<button onclick="add();">click</button>
</body>
</html>
But if I refresh the page then again the value of m starts from 0. How can I persist the value of m between each load of the page on a client machine?
you can use cookies from javascript. check this link.
http://www.w3schools.com/js/js_cookies.asp
here is the working code sample: