0

Hi I have a custom js autocomplete component using AJAX that uses a div containing a table to show matching values.

When using it in IE9 with DOCTYPE declaration the div does not appear.

The strange think is that if I have another instance of the component in tha page everything works fine (I have those components in a table and add new rows dinamically; if the table is empty at the beginning I have the problem, otherwise I can add new rows containing new instances of the component and everything works fine).

The code work fine in firefox and chrome.

It works fine in ie9 too if I specify

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="X-UA-Compatible" content="IE=8" />    

I have debugged and the javascript setting the div visible is executed to no avil:

this.resultTable.innerHTML=responseText;
this.resultTable.style.top=getY(this.editField)+22;
this.resultTable.style.left=getX(this.editField);
this.resultTable.style.zIndex="1";
this.resultTable.style.visibility='visible';

If I resize the windows the div magically appears.

Thanks in advance for you reply.


EDIT:

I have found a solution (thank to epascarello hint).

I have added

window.resizeBy(1,1);
window.resizeBy(-1,-1);

this solved almost because my page is in an iframe 100% w/h; the only remaining issue was that maximizing and restoring browser windows resulted in unecessary srollbars appearing in the iframe; I solved it adding

getFrameForDocument(document).style.width='100%';
getFrameForDocument(document).style.height='100%';

where getFrameForDocument was found at Getting a reference to the parent IFRAME and is

function getFrameForDocument(document) {
    var w= document.defaultView || document.parentWindow;
    var frames= w.parent.document.getElementsByTagName('iframe');
    for (var i= frames.length; i-->0;) {
        var frame= frames[i];
        try {
            var d= frame.contentDocument || frame.contentWindow.document;
            if (d===document)
                return frame;
        } catch(e) {}
    }
}
Community
  • 1
  • 1

0 Answers0