Guest User

Untitled

a guest
Feb 5th, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>
  5. To-Do List
  6. </title>
  7. <script type="text/javascript">
  8. function saveEdits() {
  9. //get the editable element
  10. var editElem = document.getElementById("edit");
  11. //get the edited element content
  12. var userVersion = editElem.innerHTML;
  13. //save the content to local storage
  14. localStorage.userEdits = userVersion;
  15. }
  16. function checkEdits() {
  17. //find out if the user has previously saved edits
  18. if(localStorage.userEdits!=null)
  19. document.getElementById("edit").innerHTML=localStorage.userEdits;
  20. }
  21. window.onbeforeunload = function() {saveEdits()}
  22. setInterval(function(){saveEdits()},30000);
  23. </script>
  24. <style>
  25. body {
  26. background-color:floralwhite;
  27. }
  28. #edit {
  29. border-style:dotted;
  30. border-width:1px;
  31. position:absolute;
  32. top:40px;
  33. width: 80%;
  34. font-family:"Andale Mono", Helvetica, sans-serif;
  35. font-size:200%;
  36. background-color:white;
  37. }
  38. #stuff {
  39. width: 80%;
  40. margin-left:auto;
  41. margin-right:auto;
  42. }
  43. </style>
  44. </head>
  45. <body onload="checkEdits()">
  46. <div id="stuff">
  47. <div id="edit" contenteditable="true">
  48.  
  49. </div>
  50. </div>
  51. </body>
  52. </html>
  53. <html>
  54. <head>
  55. <title>
  56. To-Do List
  57. </title>
  58. <script type="text/javascript">
  59. function saveEdits() {
  60. //get the editable element
  61. var editElem = document.getElementById("edit");
  62. //get the edited element content
  63. var userVersion = editElem.innerHTML;
  64. //save the content to local storage
  65. localStorage.userEdits = userVersion;
  66. }
  67. function checkEdits() {
  68. //find out if the user has previously saved edits
  69. if(localStorage.userEdits!=null)
  70. document.getElementById("edit").innerHTML=localStorage.userEdits;
  71. }
  72. window.onbeforeunload = function() {saveEdits()}
  73. setInterval(function(){saveEdits()},30000);
  74. </script>
  75. <style>
  76. body {
  77. background-color:floralwhite;
  78. }
  79. #edit {
  80. border-style:dotted;
  81. border-width:1px;
  82. position:absolute;
  83. top:40px;
  84. width: 80%;
  85. font-family:"Andale Mono", Helvetica, sans-serif;
  86. font-size:200%;
  87. background-color:white;
  88. }
  89. #stuff {
  90. width: 80%;
  91. margin-left:auto;
  92. margin-right:auto;
  93. }
  94. </style>
  95. </head>
  96. <body onload="checkEdits()">
  97. <div id="stuff">
  98. <div id="edit" contenteditable="true">
  99.  
  100. </div>
  101. </div>
  102. </body>
  103. </html>
Advertisement
Add Comment
Please, Sign In to add comment