changeset 811:50b4825115f0

Fix initialization of cselect from source
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 May 2009 16:59:24 -0400
parents c1f8963ebb18
children 2fbd1ac2f04b
files lib/js/urweb.js
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Sat May 16 16:37:48 2009 -0400
+++ b/lib/js/urweb.js	Sat May 16 16:59:24 2009 -0400
@@ -292,11 +292,13 @@
   populate(x);
   addNode(x);
   if (t == "select") {
+    x.innerHTML = content;
+    x.value = s.data;
     x.onchange = function() { sv(s, x.value) };
-    x.innerHTML = content;
-    sv(s, x.value);
-  } else
+  } else {
+    x.value = s.data;
     x.onkeyup = function() { sv(s, x.value) };
+  }
 
   return x;
 }