Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="calc-history">
- <span>История</span>
- <ol id="calc-history-list"></ol>
- </div>
- <script>
- var calculator = {
- resultsId: 'btnDivide',
- resultsValue: '0',
- memoryValue: '',
- historyId: 'calc-history-list',
- historyValue: []
- }
- //addToHistory:
- function () {
- if (isNaN(this.resultsValue) === false) {
- var div = document.createElement('li'), tag = document.getElementById(this.historyId);
- div.innerHTML = this.memoryValue + ' = ' + this.resultsValue;
- tag.insertBefore(div, tag.firstChild);
- }
- }
- //clearHistory:
- function () {
- $('#' + this.historyId + '> li').remove();
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement