jquery Ui-dialog and ie8

2019-08-29 01:35发布

问题:

i'm using a jquery dialog to open a sign in form. it works fine on ff,chrome and even Ie6,7 but it's not working on ie8.

this is my function:

function showSignInDialog() {
   var email = GetEmailFromCookie();
   if (!IsNullOrUndefined(email)) {
   $("input[name$='LoginEmail']").val(email);
   $("#chkRememberMe").attr("checked", "checked");
   }
   if (!$('#signInForm').dialog('isOpen')) {
   $('#signInForm').dialog({ bgiframe: true,
                             modal: true,
                             resizable: false,
                             width: 330,
                             title: 'EZtrader Login',
                             buttons: { "Login": doLogin }
                           });
    $('#signInForm').dialog('open');
  }
}

on ie8 i get a unresponsive script which means there is an infinite loop of some sort. i tried debugging it and the loop occurs in the jquery-ui js file when i try to open the dialog. i thought maybe it had something to do with "HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)" which i read about here: http://blogs.msdn.com/ie/archive/2008/04/23/what-happened-to-operation-aborted.aspx

and tried to move the script block and the dialog box around in the page but nothing seem to work. please help...

回答1:

This seems to be it: http://dev.jqueryui.com/ticket/4758

IE8's not handling the window.resize function correctly. You'll need to adjust your local version of jquery-ui from what I can tell.



回答2:

Running into the exact same set of issues. To get rid of the first issue,the "unable to modify..." error, set your script tag to be deferred=deferred.

The second issue has to do with ie8's JavaScript parser from what I can find out. There appears to be no answer, although I hadn't thought about an iframe, which if that would solve the issue, bonus!!!!



回答3:

Autocomplete must be used only on document.ready. Please move autocomplete init code into $(document).ready(function(){ [place here] }) block and all will work fine.