Advertisement
Guest User

Untitled

a guest
Aug 11th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <title></title>
  5.     <script>
  6.         dummyStart();
  7.         setSize();
  8.  
  9.         function dummyStart() {
  10.             localStorage.setItem("Size", "1");
  11.         }
  12.  
  13.         function setSize() {
  14.             var size = localStorage.getItem("Size");
  15.             if (size == "1") {
  16.                 document.getElementById("id").style.display = "none";
  17.                 toggleLayer("id");
  18.             }
  19.             else if (size == "2") {
  20.                 toggleLayer("id2");
  21.                 document.getElementById("id2").style.display = "none";
  22.             }
  23.         }
  24.  
  25.            
  26.             function toggleLayer(whichLayer) {
  27.                 if (document.getElementById) {
  28.                     // this is the way the standards work
  29.                     var style2 = document.getElementById(whichLayer).style;
  30.                     style2.display = style2.display = "none";
  31.                 }
  32.                 else if (document.all) {
  33.                     // this is the way old msie versions work
  34.                     var style2 = document.all[whichLayer].style;
  35.                     style2.display = style2.display ? "" : "none";
  36.                 }
  37.                 else if (document.layers) {
  38.                     // this is the way nn4 works
  39.                     var style2 = document.layers[whichLayer].style;
  40.                     style2.display = style2.display ? "" : "none";
  41.                 }
  42.             }
  43.     </script>
  44.     <style type="text/css">
  45.         div#id {
  46.             display: block;
  47.         }
  48.  
  49.         div#id2{
  50.             display: block;
  51.         }
  52.     </style>
  53.  
  54. </head>
  55. <body>
  56.  
  57.     <a href="javascript:toggleLayer('id');" title="Show/Hide uniqueID">Show or Hide uniqueID</a>
  58.     <div id="id">id One</div>
  59.     <div id="id2">id Two</div>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement