javascript - 无法将值传递给 jquery 函数

标签 javascript jquery

我想传值的时候不行。 这是我的代码,

function showimage(b)
{
    //if alert was here, it would show the value of b
    $("#lightboxholder").show("fast","",function (b)
    {
        alert(b);//but now when the alert is here, it is not showing the value of b
    });
}

我是不是漏掉了什么东西?提前致谢!

最佳答案

内部函数将使用新参数调用,因此 b 将替换为新变量。

如果您将 function (b) 替换为 function () - 那么内部 b 应该是给外部函数的那个​​。

关于javascript - 无法将值传递给 jquery 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13035338/

相关文章:

jquery - 使用 NuGet 更新 jquery 和现代化时自动更新脚本引用

javascript - 当数据类型为 url 时,jqgrid setColProp 不起作用

javascript - 在 Dimple.JS 中创建不完整的饼图

javascript - 如何使用 bxslider 在 2 行 slider 中显示 5 个图像

java - Java 中意外多次点击的处理

javascript - HTML - 表格、添加行、编辑行

javascript - jQuery 和面向对象的 JavaScript - 怎么样?

jquery - 在页面加载时显示第一个 div,并在我单击另一个 anchor 时隐藏它

javascript - jquery 查找和长度

javascript - 将ajax响应拆分为两个不同的div