summaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
authorGravatar Artyom Shalkhakov <artyom.shalkhakov@gmail.com>2018-05-28 21:34:07 +0600
committerGravatar Artyom Shalkhakov <artyom.shalkhakov@gmail.com>2018-05-28 21:34:07 +0600
commit7f6f6045c0c1cc9bd8323e3e7de905e0e46fe82d (patch)
tree5e21a934f0d49d35633ccbc65ab8114d4570d9e0 /lib/js
parent373cb403871c0c77f26cb76213adde3aeb278240 (diff)
Adding: cradio (support for client-side radio box).
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index d8198ed0..99b45ec9 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1205,6 +1205,19 @@ function time(s, name) {
return inpt("time", s, name);
}
+function crad(s) {
+ if (suspendScripts)
+ return;
+
+ var x = input(document.createElement("input"), s,
+ function(x) { return function(v) { x.checked = (x.value === v); }; }, "radio");
+ x.onclick = x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.value) };
+ setTimeout(function() {
+ x.defaultChecked = x.checked = (s.data === x.value);
+ }, 10);
+
+ return x;
+}
function selectValue(x) {
if (x.options.length == 0)