jQuery IE7模态怪异

时间:2011-10-05 02:36:47

标签: jquery internet-explorer modal-dialog

我有2个按钮点击触发的模态窗口。它们在除IE7之外的所有浏览器中都能正常工作(未在此下测试)

我只能演示演示中的基本功能,但这里有。第一个模态对话框工作正常,如果你点击“从服务器加载数据”它应该关闭。第二种模式根本不起作用。在演示中,当您单击“从服务器加载数据”时,它不会执行任何操作。 (当我点击它时,在我的本地副本上删除了模态背景div,wtf?)

当您首先打开第二个模态对话框窗口时,真正的曲线球会进入。然后两个模态都工作正常。这真的是我(诅咒你IE7)

我正在使用.live进行Modal窗口中的表行单击。我需要这样才能保持正确的数据发送到表单。

小提琴在这里:http://jsfiddle.net/clintongreen/5DJxv/10/

1 个答案:

答案 0 :(得分:0)

以下代码在IE7中无效:

$('#find_address_postal').click (function () {
$('.modal_form_postal').dialog('open');
$('table#table-data').attr( 'id', 'table-data_postal' );
$('table#table-data_pobox').attr( 'id', 'table-data_postal' );
$('td.address_street').removeClass("address_street").addClass("address_street_postal");
$('td.address_suburb').removeClass("address_suburb").addClass("address_suburb_postal");
$('td.address_city').removeClass("address_city").addClass("address_city_postal");
$('td.address_code').removeClass("address_code").addClass("address_code_postal");
$('td.address_street_pobox').removeClass("address_street_pobox").addClass("address_street_postal");
$('td.address_suburb_pobox').removeClass("address_suburb_pobox").addClass("address_suburb_postal");
$('td.address_city_pobox').removeClass("address_city_pobox").addClass("address_city_postal");
$('td.address_code_pobox').removeClass("address_city_pobox").addClass("address_code_postal");
$('label#suburb_search').css('display','none');
$('label#street_search').css('display','inline');
$('input#street_description').css('width','330px');
}); //end click handler

$('#find_address').click (function () {
$('.modal_form').dialog('open');
$('table#table-data_postal').attr( 'id', 'table-data' );
$('table#table-data_pobox').attr( 'id', 'table-data' );
$('td.address_street_postal').removeClass("address_street_postal").addClass("address_street");
$('td.address_suburb_postal').removeClass("address_suburb_postal").addClass("address_suburb");
$('td.address_city_postal').removeClass("address_city_postal").addClass("address_city");
$('td.address_code_postal').removeClass("address_city_postal").addClass("address_code");
$('td.address_street_pobox').removeClass("address_street_pobox").addClass("address_street");
$('td.address_suburb_pobox').removeClass("address_suburb_pobox").addClass("address_suburb");
$('td.address_city_pobox').removeClass("address_city_pobox").addClass("address_city");
$('td.address_code_pobox').removeClass("address_city_pobox").addClass("address_code");
$('label#suburb_search').css('display','none');
$('label#street_search').css('display','inline');
$('input#street_description').css('width','330px');
}); //end click handler

这在以前的所有浏览器中都有用,但是当我们实现DataTables.js时,我的代码不再仅使用两个表的模态对话框。所以我创建了2个模态对话框,一旦完成,上面的代码似乎只在IE7中冲突(并且也是问题6)。无论如何咬牙切齿之后我将上面的代码减少到了下面,现在一切正常了:)

$('#find_address_postal').click (function () {
$('.modal_form_postal').dialog('open');
}); //end click handler

$('#find_address').click (function () {
$('.modal_form').dialog('open');
}); //end click handler