IE6/7中弹出层插件colorbox中radio数值绑定问题

$(".update").click(function() {

$(
".update").colorbox({ width: "350px", height: "230px", inline: true, href: "#edit_colorbox" });

var id = $(this).parents("tr").children(".hasID").text(); //编号
var name = $(this).parents("tr").children(".hasName").text(); //名称
var status = $(this).parents("tr").children(".hasStatus").text(); //状态

$(
"#edit_id").val(id);
$(
"#edit_title_name").val(name);
$(
"input[name='edit_status'][value='" + status + "']").attr("checked", true);
});

可以获得status值,但是在ie6/7的弹出层的绑定中不起作用。哪位大神碰到过这种情况?

早些时候在博问中请教了这样的一个问题。

而后老鸟-慧☆星   
给出了--这得用live方法进行绑定--的解决办法。即是

将选择的数据绑定到表单中
$(
".update").colorbox({ width: "350px", height: "230px", inline: true, href: "#edit_colorbox", speed: 75, title: "修改双师", opacity: 0.2});
$(
".update").live("click", function() {
var id = $(this).parents("tr").children(".hasID").text(); //编号
var name = $(this).parents("tr").children(".hasName").text(); //名称
var status = $(this).parents("tr").children(".hasStatus").text(); //状态

$(
"#edit_id").val(id);
$(
"#edit_title_name").val(name);
$(
"input[name='edit_status'][value='" + status + "']").attr("checked", true);
});

感谢他的方法。然后今天看colorbox的文档,发现它有一个onComplete属性,即在弹出层加载完成后执行的方法:于是又把代码改为:

$(".update").colorbox({ width: "350px", height: "230px", inline: true, href: "#edit_colorbox", speed: 75, title: "修改双师", opacity: 0.2,
onComplete:
function() {
var id = $(this).parents("tr").children(".hasID").text(); //编号
var name = $(this).parents("tr").children(".hasName").text(); //名称
var status = $(this).parents("tr").children(".hasStatus").text(); //状态

$(
"#edit_id").val(id);
$(
"#edit_title_name").val(name);
$(
"input[name='edit_status'][value='" + status + "']").attr("checked", true);
}
});

posted on 2011-06-14 13:55  Allan GC  阅读(453)  评论(0编辑  收藏  举报

导航