我有一个项目,其中我使用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中执行此操作 这种方式可行吗?再次感谢您的帮助!