aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@csail.mit.edu>2018-06-04 09:58:50 -0400
committerGravatar GitHub <noreply@github.com>2018-06-04 09:58:50 -0400
commitea85b40d3a89447dcc65696cb1bb65bcf8806869 (patch)
tree92ba987f00bcf063155bab5160eab3ed17df1563 /lib/js/urweb.js
parent50010c982776ae62233f577f74a8e92e02c5b190 (diff)
parent4bf7bfd52e5e822b05665b1872a2cfd31417486d (diff)
Merge pull request #127 from ashalkhakov/cradio
Adding: cradio (support for client-side radio box).
Diffstat (limited to 'lib/js/urweb.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)