Advertisement
Guest User

StackOverflow q:71798689 [html]

a guest
Apr 8th, 2022
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.50 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Stack Overflow Demo</title>
  8.  
  9.     <!-- This is the css stylesheet import -->
  10.     <link rel="stylesheet" href="style.css">
  11.  
  12.     <!-- This is the javascript import containing our function definitions-->
  13.     <script src="./logic.js"></script>
  14.  
  15.     <script>
  16.         //this is the call to our main function running our logic
  17.         main();
  18.     </script>
  19. </head>
  20. <body>
  21.  
  22.     <!-- This is the template of our checkbox-label model that will be used by our js logic to add an arbitrary number of them -->
  23.     <template>
  24.         <p></p>
  25.         <label class="switch">
  26.             <input type="checkbox" id="ck" onchange="onCheckBoxStateChange(event);">
  27.             <span class="slider round hide-off"></span>
  28.         </label>
  29.         <br/>
  30.         <div class="hideme" id="label-ck">Label bound to checkbox</div>
  31.         <hr/>
  32.     </template>
  33.  
  34.     <!-- This is the button on top that will add a new Checkbox-Label pair to the page when pressed -->
  35.     <input type="button" value="Add a new checkbox to the page" onclick="addCheckboxLabelPair();" />
  36.     <!-- This is the next button on top that will reset the memory held in localStorage -->
  37.     <input type="button" value="Reset the Local Storage" onclick="cleanLocalStorage();" />
  38.     <!-- This is the next button on top that will reset the memory held in localStorage -->
  39.     <input type="button" value="Reload the page" onclick="pageReload();" />
  40.  
  41.     <!-- This is where it shows the number of checkbox states are saved in the localStorage -->
  42.     <div class="info">
  43.         This is the number of checkbox states saved in the Local Storage:<span id="stored_states_count"></span><br>
  44.         Add new checkboxes to the page to see their saved state<br>
  45.         And Remember to reload the page to see that value updated
  46.     </div>
  47.  
  48.     <p>checkbox1</p>
  49.     <label class="switch">
  50.         <input type="checkbox" id="ck1">
  51.         <span class="slider round hide-off"></span>
  52.     </label>
  53.     <br/>
  54.     <div class="hideme" id="label-ck1">Label bound to checkbox1</div>
  55.     <hr/>
  56.  
  57.     <p>checkbox2</p>
  58.     <label class="switch">    
  59.         <input type="checkbox" id="ck2">
  60.         <span class="slider round hide-off"></span>
  61.     </label>
  62.     <br/>
  63.     <div class="hideme" id="label-ck2">Label bound to checkbox2</div>
  64.     <hr/>
  65.  
  66. </body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement