繁体   English   中英

jQuery对话框IE9内容未使用html显示

[英]Jquery dialog IE9 content not showing using html

我没有一个客户端的Smalle Web应用程序。 我已经在Firefox,Chrome,IE7,IE8和IE9中对其进行了测试。

现在我不能让它失败。 我测试过的每个浏览器/版本都可以使用它。 我不确定我的客户正在使用什么版本,但他说这是IE9。

该代码是这样的:

function noticeBox(type, html, title) {
switch(type) {
    case 1:
    $('#notice_box').dialog({
        title: title,
        width: 400,
        modal: true,
        position: 'center',
        buttons: {
            'Ok': function() {
                $(this).dialog('close');
            }
        }
    });     
    break;
    case 2:
    $('#notice_box').dialog({
        title: title,
        width: 800,
        modal: true,
        position: 'center',
        buttons: {
            'Bekræft og bestil': function() {
                $('#form_products').submit();
            },
            'Annuller': function() {
                $(this).dialog('close');
            }
        }
    });     
    break;
    case 3:
    $('#notice_box').dialog({
        title: title,
        width: 400,
        modal: true,
        position: 'center',
        buttons: {
            'Luk': function() {
                $(this).dialog('close');
            }
        }   
    });
    break;
}
alert(html);
$('#notice_box').html(html);
$('#notice_box').dialog('open'); }

这不是一个非常通用的功能,但这就是当前失败的原因。 他说,弹出对话框时,对话框中没有内容。 他可以看到按钮,但就像对话框本身没有html一样。

有任何想法吗?

更新:顺便说一句,他可以激活多个对话框,并且所有对话框的结果都相同。 没有任何内容的对话框。

UPDATE2:我如何使用该功能的示例如下。 当客户订购某些产品时:

function order() {
var procuct_str = '';
var found_order = false;
$.each($('.order_input'), function(){
    var product_id = $(this).attr('id').split('-');
    if(parseInt($(this).val()) > 0) {
        found_order = true;
        procuct_str = procuct_str+'<div class="float_left"><span class="bread_text">'+$('#description-'+product_id[1]).text()+'</span></div><div class="float_right"><span class="bread_text">'+$(this).val()+'</span></div><div class="clear"></div>';
    }
}); 

if(found_order == true) {
    procuct_str = '<div class="float_left"><b>Beskrivelse</b></div><div class="float_right"><b>Antal kasser</b></div><div class="clear"></div>'+procuct_str;

    noticeBox(2, procuct_str, 'Bekræftelse');
    var found_order = false;
} }

您的html变量需要在函数范围内访问,除非您在其他地方声明了它。 从您提供的代码中, html是一个函数参数,在函数之外,它将始终是“ undefined”。

这对我来说可以。

我这样使用您的功能:

noticeBox(1, "<p>Hello</p>", "Test");

您的客户为html参数提供了什么? 一些html可能将其弄乱。 或者只是您的客户忽略了它,这可以解释为什么什么都没显示出来。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM