summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-11-22 16:40:09 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-11-22 16:40:09 -0500
commit316635920fc408c3869b239cabf60db7e079930c (patch)
tree0932537281020947e4c1b17eac47587f852662a1 /lib
parent1da43b401a4ebcd11ea4bd568326ec70fa1cc3b9 (diff)
Get dynamic <select> working in IE
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 15ff7bf2..4ee7be4b 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -445,8 +445,7 @@ function dyn(pnode, s) {
populate(x);
}
-function input(t, s, recreate, type) {
- var x = document.createElement(t);
+function input(x, s, recreate, type) {
if (type) x.type = type;
x.dead = false;
x.signal = ss(s);
@@ -459,7 +458,8 @@ function input(t, s, recreate, type) {
}
function inp(s) {
- var x = input("input", s, function(x) { return function(v) { if (x.value != v) x.value = v; }; });
+ var x = input(document.createElement("input"), s,
+ function(x) { return function(v) { if (x.value != v) x.value = v; }; });
x.value = s.data;
x.onkeyup = function() { sv(s, x.value) };
@@ -467,8 +467,9 @@ function inp(s) {
}
function sel(s, content) {
- var x = input("select", s, function(x) { return function(v) { if (x.value != v) x.value = v; }; });
- x.innerHTML = content;
+ var dummy = document.createElement("span");
+ dummy.innerHTML = "<select>" + content + "</select>";
+ var x = input(dummy.firstChild, s, function(x) { return function(v) { if (x.value != v) x.value = v; }; });
x.value = s.data;
if (x.value != s.data)
sv(s, x.value);
@@ -478,7 +479,8 @@ function sel(s, content) {
}
function chk(s) {
- var x = input("input", s, function(x) { return function(v) { if (x.checked != v) x.checked = v; }; }, "checkbox");
+ var x = input(document.createElement("input"), s,
+ function(x) { return function(v) { if (x.checked != v) x.checked = v; }; }, "checkbox");
x.checked = s.data;
x.onchange = function() { sv(s, x.checked) };