/ Published in: HTML
MIT Licensed.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<html> <head> <style> html{background:#eee;} body{width:920px;height:300px;background:white;border-radius:10px;-webkit-box-shadow:0 3px 10px grey;font:20px / 36px Arial, Helvetica, sans-serif;margin:20px auto;padding:20px;} #help{text-align:center;} #status{text-align:center;color:green;} label{display:block;text-align:center;font-size:36px;color:grey;width:840px;margin:0 auto;} input{width:auto;color:black;border:0;border-bottom:1px dotted grey;font-size:36px;text-align:right;} input:focus{outline:none;border-bottom-color:black;} button{font-size:36px;display:block;width:770px;cursor:pointer;margin:20px auto;padding:10px 0;} </style> </head> <script type="text/javascript"> // Saves options to localStorage. function save_options() { var text = document.getElementById("url"); var url = text.value; localStorage["saved_url"] = url; // Update status to let user know options were saved. var status = document.getElementById("status"); status.innerHTML = "URL Saved."; setTimeout(function() { status.innerHTML = ""; }, 750); restore_options(); } // Restores text box state to saved value from localStorage. function restore_options() { var saved = localStorage["saved_url"]; if (saved == undefined || saved == null || saved == '') { var help = document.getElementById("help"); return; } var text = document.getElementById("url"); text.value = saved; } </script> <body onload="restore_options()"> <div id="help"> </div> </body> </html>