Mercurial > urweb
diff 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 |
line wrap: on
line diff
--- a/jslib/urweb.js Thu Jan 08 10:30:14 2009 -0500 +++ b/jslib/urweb.js Sun Jan 11 10:05:06 2009 -0500 @@ -41,6 +41,14 @@ s.h = cons(function() { x.innerHTML = s.v }, s.h); } +function inp(t, s) { + var x = document.createElement(t); + x.value = s.v; + document.body.appendChild(x); + s.h = cons(function() { x.value = s.v }, s.h); + x.onkeyup = function() { sv(s, x.value) }; +} + function eh(x) { return x.split("&").join("&").split("<").join("<").split(">").join(">"); }