方法一、

1
2
3
4
function GetCode(event)
{
alert(event.data.foo);
}
1
2
3
4
$(document).ready(function()
{
$("#summary").bind("click", {foo:'abc'} ,GetCode);
});

方法二、

函数句柄

1
2
3
4
$("#summary").bind("click", function()
{
GetCode("abc")
});
1
2
3
function GetCode(str)
{
}

方法三、

函数闭包

1
2
3
4
5
6
function GetCode(str)
{
return function()
{
alert(str)
}}
1
$("#summary").bind("click", GetCode("abc"));

相关文章:

  • 2022-12-23
  • 2021-09-14
  • 2022-02-28
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
猜你喜欢
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2021-09-22
  • 2022-12-23
相关资源
相似解决方案