comparison jslib/urweb.js @ 598:4c2c740c6931

Hooking a source into an input
author Adam Chlipala <adamc@hcoop.net>
date Sun, 11 Jan 2009 10:05:06 -0500
parents d49d58a69877
children d1cce194180d
comparison
equal deleted inserted replaced
597:d49d58a69877 598:4c2c740c6931
39 x.innerHTML = s.v; 39 x.innerHTML = s.v;
40 document.body.appendChild(x); 40 document.body.appendChild(x);
41 s.h = cons(function() { x.innerHTML = s.v }, s.h); 41 s.h = cons(function() { x.innerHTML = s.v }, s.h);
42 } 42 }
43 43
44 function inp(t, s) {
45 var x = document.createElement(t);
46 x.value = s.v;
47 document.body.appendChild(x);
48 s.h = cons(function() { x.value = s.v }, s.h);
49 x.onkeyup = function() { sv(s, x.value) };
50 }
51
44 function eh(x) { 52 function eh(x) {
45 return x.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;"); 53 return x.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
46 } 54 }
47 55
48 function ts(x) { return x.toString() } 56 function ts(x) { return x.toString() }