【发布时间】:2020-12-20 02:17:49
【问题描述】:
我正在尝试从 .js 中获取所有选定复选框和单选按钮的值,并通过单击按钮将其传递给 .jsx 函数。 .jsx 函数包含 10 个函数。
我想要实现的是我将数组中的字符串作为函数调用。喜欢
[value1, value2, value3....] 到 值1();价值2(); value3();
这是我在 .js 和 .jsx 中的代码:
//---------------------This is the .js part-----------------------------
$("#button").on('click', function () {
var csInterface = new CSInterface();
var selected = new Array();
$("input[type=checkbox]:checked").each(function () {
selected.push(this.value);
});
$("input[type=radio]:checked").each(function () {
selected.push(this.value);
});
if (selected.length > 0) {
csInterface.evalScript("secondFunction(" + selected + ")");
}
});
//---------------------This is the .jsx part-----------------------------
function secondFunction(selected){
//the functions below in this function have to be executed one after another
function value1{...};
function value2{...};
function value3{...};
};
【问题讨论】:
标签: javascript