change the parent window of a DIV.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    change the parent window of a DIV.

    I have a lot of frames in a window.
    In one of them i placed a IFRAME and change the source of my target page.
    Now what I need, if i click a link on that page a DIV should be opening on the middle of the main window.
    But if is opening at the middle of the iframe.

    My JS code goes here.
    [code=javascript]
    var left = window.top.scre en.availWidth/2-250,top = 100;
    [/code]

    Now i am positioning the DIV at calculated LEFT and TOP position.
    Please help me!!!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Hey, dmjpro, long time, no see!

    Show the code that positions the div.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by acoder
      Hey, dmjpro, long time, no see!

      Show the code that positions the div.
      Actually i m busy with my work.
      Here is my code.

      [code=js]
      div_ref.style.l eft = left+'px';
      div_ref.style.t op = top+'px';
      div_ref.style.d isplay = 'block';
      [/code]

      The code positions the DIV in that window which contains the DIV code.
      But i wanna position the DIV with respect to any window or any frame.
      Should I add any style?

      Debasis Jana

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        If the div is inside a particular frame/window, it will obviously only display within it. What you can do is clone or import it. See cloneNode and importNode.

        Comment

        Working...