我<a>
在此 div 上的每个上绑定单击事件时遇到问题:
<div id="box_list_menu" class="boxlistmenu">
<a href="/profile/00000000-0000-0000-0000-000000000001/grantAccessToPrivatePhotos/index.php?tid=${ID}&un=${Name}" id="${ID}_grantAccessPrivatephotos" rel="link" class="boxlistmenu_grantaccessprivatephotos" title="Donner accès à vos photos privées"></a>
<a href="/profile/00000000-0000-0000-0000-000000000001/denyAccessToPrivatePhotos/index.php?tid=${ID}&un=${Name}" id="${ID}_denyAccessPrivatephotos" rel="link" class="boxlistmenu_denyaccessprivatephotos" title="Retirer l'accès à vos photos privées"></a>
<a href="/profile/00000000-0000-0000-0000-000000000001/block/index.php?tid=${ID}" id="${ID}_unblock" rel="link" class="boxlistmenu_block" title="Bloquer ce membre"></a>
<a href="/profile/00000000-0000-0000-0000-000000000001/unblock/index.php?tid=${ID}" id="${ID}_block" rel="link" class="boxlistmenu_unblock" title="Débloquer ce membre"></a>
<a href="/profile/report/00000000-0000-0000-0000-000000000001/index.php?tid=${ID}&un=${Name}" rel="link" class="boxlistmenu_report" title="Signaler ce profil à un administrateur"></a>
</div>
这是我的jQuery代码:
container.find('#box_list_menu:a').bind("click", function (e) {
e.stopPropagation();
var t = this.id.split("_");
var profileID = t[0];
var action = t[1];
var btn = $(this);
btn.trigger("blur").attr("disabled", "disabled").addClass("inactive").find("b").html(bscTexts.search.pleaseWait);
alert("boxlist_menu action = " +action+ " e = " +e);
switch (action) {
case "block":
bsc.event.addListener(bsc.menu.listenerTypes.block, "profile", function (e) {
$("#" + profileID + "_block").hide();
$("#" + profileID + "_unblock").show();
btn.removeAttr("disabled").removeClass("inactive").find("b").html(btn.attr("title"));
});
bsc.menu.BlockProfile(e, profileID);
break;
case "unblock":
bsc.event.addListener(bsc.menu.listenerTypes.unblock, "profile", function (e) {
$("#" + profileID + "_unblock").hide();
$("#" + profileID + "_block").show();
btn.removeAttr("disabled").removeClass("inactive").find("b").html(btn.attr("title"));
});
bsc.menu.UnblockProfile(e, profileID);
break;
case "grantAccessPrivatephotos":
bsc.event.addListener(bsc.menu.listenerTypes.grantAccessPrivatephotos, "profile", function (e) {
$("#" + profileID + "_grantAccessPrivatephotos").hide();
$("#" + profileID + "_denyAccessPrivatephotos").show();
btn.removeAttr("disabled").removeClass("inactive").find("b").html(btn.attr("title"));
});
bsc.menu.GrantAccessToPrivatePhotos(e, profileID);
break;
case "denyAccessPrivatephotos":
bsc.event.addListener(bsc.menu.listenerTypes.denyAccessPrivatephotos, "profile", function (e) {
$("#" + profileID + "_denyAccessPrivatephotos").hide();
$("#" + profileID + "_grantAccessPrivatephotos").show();
btn.removeAttr("disabled").removeClass("inactive").find("b").html(btn.attr("title"));
});
bsc.menu.DenyAccessToPrivatePhotos(e, profileID);
break;
default:
}
return false;
});
只有 a href 被执行,永远不要进入容器。发现我的警报弹出窗口永远不会打开,开关盒永远不会执行,我的 addListener 永远不会添加!
非常感谢您的帮助