簡體   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