Need help with javascript behavior in IE. Popup appears off screen

Discussion in 'JavaScript' started by netprospector, Sep 29, 2011.

  1. #1
    I have a WP blog that has the following code in a text sidebar widget (right if it matters) (3 columns)

    <script id="lb_client_form" type="text/javascript" src="http://www.listingbook.com/cgi-bin/controls/client_form/?uid=A185090&amp;btn=orange.gif"></script>

    It pops up a signup window from this third party. It should center on the screen. Works fine on Firefox (Win & Mac), works fine on safari, works fine on chrome.

    On IE (8.0.7600.163865) it centers in the middlw of the main column text area. This happens to be a long page so it ends up off screen and you have to scroll down to see it.

    This is third party code so i can't really change the code (at least i don't know how) any suggestions? Anyway to re-position after I pop it up? javascript is not my strength.

    Thanks,

    Ed
     
    netprospector, Sep 29, 2011 IP
  2. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #2
    here's the problem from the script in the widget..
    
    LBClientForm.prototype.viewport_center = function(a){ var edge = 'Left', dim = 'Width'; if(a == 'Y'){ edge = 'Top'; dim = 'Height'; } var scroll = eval('self.page'+a+'Offset'), center = eval('self.inner'+dim); if(!scroll) scroll = this.doc_val('scroll'+edge); if(!center) center = this.doc_val('client'+dim); return Math.floor(scroll + (center - this.popup[dim.toLowerCase()]) / 2); }
    
    Code (markup):
    the javascript code from the widget only reads pageXOffset or pageYOffset (that is var scroll = eval('self.page'+a+'Offset') ) and innerWidth or innerHeight (that is eval('self.inner'+dim)).. in which IE does not know (support)! http://www.quirksmode.org/dom/w3c_cssom.html (really hated IE for this kind of things.. hehehe.)

    if you have any access to this script of the widget, you can maybe modify it and make it compatible to IE.. you will just add some lines just for IE.
     
    JohnnySchultz, Oct 3, 2011 IP