diff lib/js/urweb.js @ 797:2c463eee89fa

cselect
author Adam Chlipala <adamc@hcoop.net>
date Thu, 14 May 2009 09:33:48 -0400
parents 796e42c93c48
children 83875a9eb9b8
line wrap: on
line diff
--- a/lib/js/urweb.js	Thu May 14 09:11:58 2009 -0400
+++ b/lib/js/urweb.js	Thu May 14 09:33:48 2009 -0400
@@ -281,7 +281,7 @@
   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 @@
   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;
 }