OLD | NEW |
(Empty) | |
| 1 <head> |
| 2 <title>ChromeVox Options</title> |
| 3 <script type="text/javascript"> |
| 4 |
| 5 |
| 6 // Saves options to localStorage. |
| 7 function save_options() { |
| 8 localStorage["test"] = document.getElementById("test").value; |
| 9 } |
| 10 |
| 11 // Restores default options |
| 12 function restore_defaults() { |
| 13 document.getElementById("test").value = "foo"; |
| 14 } |
| 15 |
| 16 // Restores select box state to saved value from localStorage. |
| 17 function restore_options() { |
| 18 if (!localStorage["test"]) { |
| 19 restore_defaults(); |
| 20 save_options(); |
| 21 } |
| 22 |
| 23 document.getElementById("test").value = localStorage["test"]; |
| 24 } |
| 25 |
| 26 </script> |
| 27 </head> |
| 28 <html> |
| 29 <body onload="restore_options()"> |
| 30 |
| 31 <h2 id="title"></h2> |
| 32 <div id="options"> |
| 33 |
| 34 <label for="test" id="testLabel">Test</label> |
| 35 <input id="test" type="text"><br /> |
| 36 <br /> |
| 37 |
| 38 <button id="saveButton" onclick="save_options()">Save</button> |
| 39 <button id="restoreButton" onclick="restore_defaults()">Restore</button> |
| 40 </div> |
| 41 |
| 42 </body> |
| 43 </html> |
OLD | NEW |