如何评估一个 JavaScript 函数的返回值

我有一个项目,其中使用 HTML/JS 和 Lua。我想要评估一个简单函数的返回值,老实说我不知道该怎么做,以下是代码片段:

.......................................

<% if channel == nil  then %>
<form name = "f1">
    <input type = "radio" Name = "r1" Value = "Input" onClick="GetSelectedItem(this)">Input
    <input type = "radio" Name = "r1" Value = "Output" onClick ="GetSelectedItem(this)">Output
    <input type = "radio" Name = "r1" Value = "Virtual" onClick ="GetSelectedItem(this)">Virtual
</form>

<div id="output"></div>     //  how can I  use this value in lua????
    <% end %>
...................................
<script>
var output = document.getElementById('output');

function GetSelectedItem(el) {
    output.innerHTML = el.value;
}
</script>

更新

由于无法告诉 Lua 选择了哪个按钮,是否可以在 HTML 中评估返回值?

if ( value == 1 ) then
<% lua code for the 1. case %>
if ( value == 2) then

等等 我写 C 代码是因为我不知道如何在 HTML/js 中实现。这种方式可行吗?非常感谢您的帮助!

点赞