BrU32

JS Session Storage Count Increment/Clear Demo SRC V1

Dec 4th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. <script>
  2.  
  3. clear(); //Use To Clear The Session Storage.
  4.  
  5. this.onclick=function(){
  6.  
  7. sessionStorage.clickcount++
  8.  
  9. document.body.innerHTML = "You have clicked the webpage " + sessionStorage.clickcount + " times this session!!";
  10.  
  11. }
  12.  
  13. function clear(){
  14. sessionStorage.clickcount=0;
  15. }
  16. </script>
Advertisement
Add Comment
Please, Sign In to add comment