sessionCookieDest.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Session cookie destination</title>
  5. <script type="text/javascript">
  6. //Get cookie routine by Shelley Powers
  7. function get_cookie(Name) {
  8. var search = Name + "=";
  9. var returnvalue = "";
  10. if (document.cookie.length > 0) {
  11. offset = document.cookie.indexOf(search);
  12. // if cookie exists
  13. if (offset != -1) {
  14. offset += search.length;
  15. // set index of beginning of value
  16. end = document.cookie.indexOf(";", offset);
  17. // set index of end of cookie value
  18. if (end == -1) end = document.cookie.length;
  19. returnvalue=unescape(document.cookie.substring(offset, end))
  20. }
  21. }
  22. return returnvalue;
  23. }
  24. function setcolor(){
  25. document.body.style.backgroundColor=get_cookie("bgcolor")
  26. }
  27. </script>
  28. </head>
  29. <body onload="setcolor()">
  30. This is the cookie destination page.
  31. </body>
  32. </html>