Wierd zindex behavior

Discussion in 'Javascript' started by Razzbar, May 1, 2004.

  1. Razzbar

    Razzbar Guest

    I'm using a div as a floating dialog box. I'd rather use a popup
    window, but due to all the popup blockers in use, I have to use
    another method, a div that has absolute positioning.

    The damn thing won't get in front of dropdown listboxes! I
    check the currentstyle.zindex of the listoxes, and they're
    set at 0. I set the div.style.zindex to some higher number,
    and it doesn't help. I minimize and restore the window,
    hoping it will redraw correctly, but no luck.

    IE 6. Bug. BAH!

    Any suggestions?

    TIA,
     
    Razzbar, May 1, 2004
    #1
    1. Advertising

  2. On 1 May 2004 14:39:12 -0700, Razzbar <2s.com> wrote:

    > I'm using a div as a floating dialog box. I'd rather use a popup
    > window, but due to all the popup blockers in use, I have to use
    > another method, a div that has absolute positioning.
    >
    > The damn thing won't get in front of dropdown listboxes! I
    > check the currentstyle.zindex of the listoxes, and they're
    > set at 0. I set the div.style.zindex to some higher number,
    > and it doesn't help. I minimize and restore the window,
    > hoping it will redraw correctly, but no luck.
    >
    > IE 6. Bug. BAH!


    It's not restricted to IE, and there's nothing you can do about it. It's
    simply how the browser (or OS, depending) renders the control.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
     
    Michael Winter, May 3, 2004
    #2
    1. Advertising

  3. Michael Winter wrote:
    > Razzbar wrote:

    <snip>
    >> set at 0. ...
    >> and it doesn't help. I minimize and restore the window,
    >> hoping it will redraw correctly, but no luck.

    <snip>
    > It's not restricted to IE, and there's nothing you can do about it.
    > It's simply how the browser (or OS, depending) renders the control.


    One proposed strategy for dealing with the way form controls show
    through positioned DIVs is to set their visibility style property to
    "hidden" on the controls. Either hiding all of the controls on a page
    whenever the DIV is visible (which shouldn't be a problem if the DIV is
    acting as a modal dialog), or comparing the control positions with the
    offsets box of the DIV and hiding any controls that are overlapped by
    the DIV (quite a lot of work to implement cross-browser), and
    re-revealing them when uncovered.

    Netscape 4 rather ruins that plan as it is not possible to individually
    hide form controls and putting them in a positioned DIV/Layer and hiding
    that influences how they are interpreted as part of any containing form.

    Richard.
     
    Richard Cornford, May 3, 2004
    #3
  4. Razzbar

    Jim Ley Guest

    On Mon, 3 May 2004 15:43:28 +0100, "Richard Cornford"
    <> wrote:

    >One proposed strategy for dealing with the way form controls show
    >through positioned DIVs is to set their visibility style property to
    >"hidden" on the controls. Either hiding all of the controls on a page
    >whenever the DIV is visible (which shouldn't be a problem if the DIV is
    >acting as a modal dialog), or comparing the control positions with the
    >offsets box of the DIV and hiding any controls that are overlapped by
    >the DIV (quite a lot of work to implement cross-browser), and
    >re-revealing them when uncovered.


    I tend to use IFRAME's as dividers, add to the DIV a firstChild which
    is an empty iframe sized to the same size as the DIV.

    Jim.
    --
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Jim Ley, May 3, 2004
    #4
  5. Razzbar

    Matt Kruse Guest

    Jim Ley wrote:
    > I tend to use IFRAME's as dividers, add to the DIV a firstChild which
    > is an empty iframe sized to the same size as the DIV.


    This is indeed the best solution I've found. Iframes will always show over
    select objects and other windows controls, so using them as "popups" seems
    to be the best solution all-around (for browsers which support them).
    I use this approach in a new version of a popup window library which I'm
    testing and refining:
    http://www.mattkruse.com/javascript/popupwindow/temp.html

    This solution tries to use the "best available" popup method if the user
    doesn't specify one. If the browser is able to create new objects, then it
    tries to create a DIV and populate it. Unless the page has select elements,
    in which cases it tries to create an IFRAME and use it. It's not perfect,
    and I haven't done full cross-browser testing, but I think in theory it will
    work well, and hide all the implementation mess from a user who simply wants
    a popup that behaves as expected.

    --
    Matt Kruse
    Javascript Toolbox: http://www.mattkruse.com/javascript/
     
    Matt Kruse, May 3, 2004
    #5
  6. Razzbar

    Jim Ley Guest

    On Mon, 3 May 2004 10:34:43 -0500, "Matt Kruse"
    <> wrote:

    >This solution tries to use the "best available" popup method if the user
    >doesn't specify one. If the browser is able to create new objects, then it
    >tries to create a DIV and populate it. Unless the page has select elements,
    >in which cases it tries to create an IFRAME and use it. It's not perfect,
    >and I haven't done full cross-browser testing, but I think in theory it will
    >work well, and hide all the implementation mess from a user who simply wants
    >a popup that behaves as expected.


    Ah, I don't use IFRAMES to actually hold the content, that makes
    adding script to them difficult and means you have to load stylesheets
    etc. into the IFRAME. I just use it as a divider:

    so you get something like this:

    <div>
    <iframe src="javascript:'<html></body></html>"
    style="position:absolute;z-index:-1;top:-1;left:-1;height:100px;width:100px;overflow:hidden;"></iframe>
    Your popup content
    </div>

    Jim.
    --
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Jim Ley, May 3, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. paul reed

    Wierd Behavior of __doPostBack

    paul reed, Jul 8, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    561
    Bassel Tabbara [MSFT]
    Jul 8, 2003
  2. Steve

    Wierd datalist behavior

    Steve, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    331
    Steve
    Jul 8, 2003
  3. Replies:
    0
    Views:
    591
  4. JohnDpatriot

    Permission denied on Zindex after XP SP2

    JohnDpatriot, Sep 27, 2004, in forum: ASP General
    Replies:
    1
    Views:
    109
    Aaron [SQL Server MVP]
    Sep 27, 2004
  5. DJ WIce

    Get hi-est zIndex on the page

    DJ WIce, Jan 25, 2004, in forum: Javascript
    Replies:
    22
    Views:
    210
    DJ WIce
    Jan 28, 2004
Loading...

Share This Page