我正在用 Hiccup(和其他东西)在 clojure 中编写一个网络服务器应用程序。我正在尝试使用一个小 JS 启用和禁用两个下拉字段的复选框,但我无法使其工作。
[:head
[:script "function toggleText(cb, t1, t2) {
document.getElementById(t1).disabled = !cb.checked;
document.getElementById(t2).disabled = !cb.checked;
}"]]
[:td (hf/check-box {:on-change (str "toggleText(" (name endtag) "," (name tytag) "," (name tmtag) ")")} endtag)]
[:td (hf/drop-down tytag (range 2013 2031) 2017)]
[:td (hf/drop-down tmtag (range 1 13) 6)]