comparison 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
comparison
equal deleted inserted replaced
796:6271f0e3c272 797:2c463eee89fa
279 }; 279 };
280 addNode(x); 280 addNode(x);
281 populate(x); 281 populate(x);
282 } 282 }
283 283
284 function inp(t, s) { 284 function inp(t, s, content) {
285 var x = document.createElement(t); 285 var x = document.createElement(t);
286 x.dead = false; 286 x.dead = false;
287 x.signal = ss(s); 287 x.signal = ss(s);
288 x.sources = null; 288 x.sources = null;
289 x.recreate = function(v) { if (x.value != v) x.value = v; }; 289 x.recreate = function(v) { if (x.value != v) x.value = v; };
290 populate(x); 290 populate(x);
291 addNode(x); 291 addNode(x);
292 x.onkeyup = function() { sv(s, x.value) }; 292 if (t == "select") {
293 x.onchange = function() { sv(s, x.value) };
294 x.innerHTML = content;
295 sv(s, x.value);
296 } else
297 x.onkeyup = function() { sv(s, x.value) };
298
293 return x; 299 return x;
294 } 300 }
295 301
296 302
297 // Basic string operations 303 // Basic string operations