簡體   English   中英

IE8無法使用jQuery對話框

[英]IE8 not working with jQuery Dialog

我有一個HTML表單:

<div id="dialog" class="event-dialog" title="Create Event">
    <div id="dialog-inner">
    <table>
        <tr><td align="left">Event Name:</td><td align="left"><input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all title"></td></tr>
        <tr><td align="left" valign="top">Event Description:</td><td><textarea name="description" id="description" class="text ui-widget-content ui-corner-all" rows="3" cols="40"></textarea></td></tr>
        <tr><td align="left">All Day Event:</td><td align="left"><input id="all-day" type="checkbox" value="false"></td></tr>
     </table>
     </div>
</div>

我也有以下jQuery代碼:

jQuery("#dialog").dialog({
    autoOpen: false,
    height: 600,
    width: 700,
    modal: true,
    buttons: {
        'Create event': function () {
            name = jQuery("#name").val();
            jQuery(this).dialog('close');
        },
        Cancel: function () {
            jQuery(this).dialog('close');
        }
    },
    close: function () {
    }
});

我刪除了我的jQuery代碼中的一些內容,只是為了將其縮短為StackOverflow。 該代碼可在Chrome,Firefox,Safari等環境中運行,但是由於某些原因,它僅在IE8中顯示對話框形式。 知道為什么它不會在IE8中隱藏表單嗎?

我遇到了類似的問題,但我的解決方案是另一個問題:我的網站上有一些Flash對象。 這些對象由IE永久呈現在前景中。 結果是,對話框出現在Flash對象的后面,而我只能看到鎖屏而不顯示對話框。

我的丑陋解決方案:在顯示對話框之前,我隱藏了Flash對象。 關閉對話框后,我再次顯示對象。 這樣可行。

不久前,我也發生了同樣的事情。 這是您的確切HTML代碼嗎? 如果不是,請確保在對話框div中不使用自動關閉標簽。

 <div id="dialog-save">
    <div id="content" /> //this one didn't work.
    <div id="content"></div> //this one worked.
 </div>

由於某些原因,IE不喜歡jquery-ui的自關閉標簽。

就我而言,一個額外的關閉div會造成問題。

<div class="comment_video"  >
 // content
</div>
</div>  // this closing div is creating problem.

我刪除了最后一個關閉的div,它工作正常。 看起來IE 8對HTML標准非常嚴格

希望對您有所幫助。

我通過使用jQuery添加CSS類發現了相同的錯誤:

jQuery( "#dialog-noresult" ).dialog({
    modal: true,
    autoOpen: false,
    width: 500,
    height: 630,
    buttons: {
        "Cancel": {
             text: 'Cancel',
             class: 'dialog_Cancel',
             click: function() {
                 jQuery( this ).dialog( "close" );
             }
    }, ...
});

我通過在類選項中添加引號來解決它。

"class":'dialog_Cancel',

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM