Advertisement
Guest User

setting cookie

a guest
May 27th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3. var breadcrumbLink = document.getElementsByClassName("sensei-breadcrumb").childNodes, str="a"; // this sets a variable to the hyperlink inside of the breadcrumbs div that takes the user back to the module page
  4.  
  5. breadcrumbLink.onclick = function(){
  6. var moduleCookie = Cookies.set('module-control', 'value');
  7. }; // when the user clicks on the link a cookie is made with the name module-control and a variable is called moduleCookie
  8.  
  9. window.onbeforeunload = function () {
  10. var moduleCookie = Cookies.set('module-control', 'value');
  11. } // when the user clicks the back button a cookie is made with the name module-control and a variable is called moduleCookie
  12.  
  13. function changediv()
  14. {
  15. if ( moduleCookie.length > 0) {
  16. document.getElementById("") {
  17. document.getElementById("").setAttribute("id", "module1")
  18. }
  19. return Cookies.remove('module-control');
  20. }
  21. } // if moduleCookie exists get div by class and change the div id to module1
  22. )};
  23. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement