Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <script>
- dummyStart();
- setSize();
- function dummyStart() {
- localStorage.setItem("Size", "1");
- }
- function setSize() {
- var size = localStorage.getItem("Size");
- if (size == "1") {
- document.getElementById("id").style.display = "none";
- toggleLayer("id");
- }
- else if (size == "2") {
- toggleLayer("id2");
- document.getElementById("id2").style.display = "none";
- }
- }
- function toggleLayer(whichLayer) {
- if (document.getElementById) {
- // this is the way the standards work
- var style2 = document.getElementById(whichLayer).style;
- style2.display = style2.display = "none";
- }
- else if (document.all) {
- // this is the way old msie versions work
- var style2 = document.all[whichLayer].style;
- style2.display = style2.display ? "" : "none";
- }
- else if (document.layers) {
- // this is the way nn4 works
- var style2 = document.layers[whichLayer].style;
- style2.display = style2.display ? "" : "none";
- }
- }
- </script>
- <style type="text/css">
- div#id {
- display: block;
- }
- div#id2{
- display: block;
- }
- </style>
- </head>
- <body>
- <a href="javascript:toggleLayer('id');" title="Show/Hide uniqueID">Show or Hide uniqueID</a>
- <div id="id">id One</div>
- <div id="id2">id Two</div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement