diff options
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/urweb.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 6215a54c..8ca6b89c 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -512,7 +512,18 @@ function tbx(s) { function addOnChange(x, f) { var old = x.onchange; - x.onchange = function() { old(); f (); }; + if (old == null) + x.onchange = f; + else + x.onchange = function() { old(); f(); }; +} + +function addOnKeyUp(x, f) { + var old = x.onkeyup; + if (old == null) + x.onkeyup = f; + else + x.onkeyup = function(x) { old(x); f(x); }; } @@ -893,7 +904,7 @@ function sp(e) { var uw_event = null; function kc() { - return window.event ? uw_event.keyCode : uw_event.which; + return window.event ? event.keyCode : (uw_event ? uw_event.keyCode : 0); } @@ -1164,5 +1175,12 @@ function execF(f, x) { } +// Wrappers + +function confrm(s) { + return confirm(s) ? true : false; +} + + // App-specific code |