Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <div id="calc-history">
  2. <span>История</span>
  3. <ol id="calc-history-list"></ol>
  4. </div>
  5.  
  6. <script>
  7. var calculator = {
  8. resultsId: 'btnDivide',
  9. resultsValue: '0',
  10. memoryValue: '',
  11. historyId: 'calc-history-list',
  12. historyValue: []
  13. }
  14.  
  15. //addToHistory:
  16.  
  17. function () {
  18. if (isNaN(this.resultsValue) === false) {
  19. var div = document.createElement('li'), tag = document.getElementById(this.historyId);
  20. div.innerHTML = this.memoryValue + ' = ' + this.resultsValue;
  21. tag.insertBefore(div, tag.firstChild);
  22. }
  23. }
  24.  
  25. //clearHistory:
  26.  
  27. function () {
  28. $('#' + this.historyId + '> li').remove();
  29. }
  30. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement