Guest User

Untitled

a guest
Feb 5th, 2013
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title>
  4. To-Do List
  5. </title>
  6. <script type="text/javascript">
  7. function saveEdits() {
  8. //get the editable element
  9. var editElem = document.getElementById("edit");
  10. //get the edited element content
  11. var userVersion = editElem.innerHTML;
  12. //save the content to local storage
  13. localStorage.userEdits = userVersion;
  14. }
  15. function checkEdits() {
  16. //find out if the user has previously saved edits
  17. if(localStorage.userEdits!=null)
  18. document.getElementById("edit").innerHTML=localStorage.userEdits;
  19. }
  20. window.onbeforeunload = function() {saveEdits()}
  21. setInterval(function(){saveEdits()},30000);
  22. </script>
  23. <style>
  24. body {
  25. background-color:floralwhite;
  26. }
  27. #edit {
  28. border-style:dotted;
  29. border-width:1px;
  30. position:absolute;
  31. top:40px;
  32. width: 80%;
  33. font-family:"Andale Mono", Helvetica, sans-serif;
  34. font-size:200%;
  35. background-color:white;
  36. }
  37. #stuff {
  38. width: 80%;
  39. margin-left:auto;
  40. margin-right:auto;
  41. }
  42. </style>
  43. </head>
  44. <body onload="checkEdits()">
  45. <div id="stuff">
  46. <div id="edit" contenteditable="true">
  47.  
  48. </div>
  49. </div>
  50. </body>
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment