一个简单的js计数器(web储存)。
1 <span id="countspan"></span> 2 <a href="#" onclick="countNumber();">点击</a> 3 <script type="text/javascript"> 4 if(!localStorage.countAll){ 5 localStorage.countAll = 0; 6 } 7 document.getElementById('countspan').innerHTML = localStorage.countAll; 8 function countNumber(){ 9 localStorage.countAll++; 10 document.getElementById('countspan').innerHTML = localStorage.countAll; 11 } 12 </script>