当前位置:Gxlcms > JavaScript > Jquery之Bind方法参数传递与接收的三种方法

Jquery之Bind方法参数传递与接收的三种方法

时间:2021-07-01 10:21:17 帮助过:3人阅读

方法一、

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

方法二、

函数句柄

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

方法三、

函数闭包

function GetCode(str)
{
return function()
{
alert(str)
}}
$("#summary").bind("click", GetCode("abc"));

人气教程排行