From 29f71e629bfe700a4bfcc7d2018bdab305d6fc3e Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 14 May 2009 09:33:48 -0400 Subject: cselect --- lib/js/urweb.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/js') diff --git a/lib/js/urweb.js b/lib/js/urweb.js index a29914b9..5482c2a5 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -281,7 +281,7 @@ function dyn(s) { populate(x); } -function inp(t, s) { +function inp(t, s, content) { var x = document.createElement(t); x.dead = false; x.signal = ss(s); @@ -289,7 +289,13 @@ function inp(t, s) { x.recreate = function(v) { if (x.value != v) x.value = v; }; populate(x); addNode(x); - x.onkeyup = function() { sv(s, x.value) }; + if (t == "select") { + x.onchange = function() { sv(s, x.value) }; + x.innerHTML = content; + sv(s, x.value); + } else + x.onkeyup = function() { sv(s, x.value) }; + return x; } -- cgit v1.2.3