【发布时间】:2011-08-26 13:34:49
【问题描述】:
假设我有以下功能:
function checkPanes() {
activePane = '';
var panels = $("#slider .box .panel");
panels.each(function() {
//find the one in visible state.
if ($(this).is(":visible")) {
activePane = $(this).index()+1;
console.log(activePane);
}
});
} //END checkPanes();
理想情况下,我想在其他地方调用这个函数(很可能来自另一个函数), 并检索我当前输出到控制台的值。
(示例..)
function exampleCase() {
checkPanes(); //evidently, does not return anything.
//Ideally, I want the numerical value, being output to console in above function.
}
提前致谢!非常感谢所有建议/cmets。
干杯
【问题讨论】:
-
你试过
return activePane;吗?
标签: javascript jquery function return-value javascript-framework