diff --git a/controller.number.js b/controller.number.js index cfbb1b4..ba2c23d 100644 --- a/controller.number.js +++ b/controller.number.js @@ -24,10 +24,10 @@ var NumberController = function() { button.setAttribute('value', inc) this.domElement.appendChild(button); - button.onmousedown = function(e) { + button.addEventListener('mousedown', function(e) { isClicked = true; - }; - button.onkeyup = function(e) { + }, false); + button.addEventListener('keyup', function(e) { var val = parseFloat(this.value); if(isNaN(val)) { inc = initialValue; @@ -36,11 +36,11 @@ var NumberController = function() { } this.value = inc; _this.setValue(inc); - } - document.onmouseup = function(e) { + }, false); + document.addEventListener('mouseup', function(e) { isClicked = false; - }; - document.onmousemove = function(e) { + }, false); + document.addEventListener('mousemove', function(e) { if(isClicked) { e.preventDefault(); py = y; @@ -61,7 +61,7 @@ var NumberController = function() { button.value = inc; _this.setValue(inc); } - }; + }, false); this.__defineSetter__("position", function(val) { inc = val; diff --git a/controller.string.js b/controller.string.js index 07b6b86..679e59c 100644 --- a/controller.string.js +++ b/controller.string.js @@ -20,12 +20,12 @@ var StringController = function() { _this.setValue(input.value); }, false); - input.onblur = function(e) { + input.addEventListener('blur', function(e) { if(_this.getValue() == '') { _this.setValue(initialValue); this.value = initialValue; } - }; + }, false); this.domElement.appendChild(input); };