Frame destruction

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

    Frame destruction

    I can simulate a frame destruction by make the frame invisible. But if i want to totally destroy the frame then i tried a code ..but it not working properly ... just .. simply could invalidate the frame ..but still i could get the frame object reference ..

    Please have a look at my code ..
    Code:
    <frameset rows="50%,50%" border="1">
    <frame src="controlPage.html" id="controlFrame" />
    <frame src="" id="emptyFrame" />
    </frameset>
    The source code of
    Code:
    <script type="text/javascript">
    function destroy(){
    var emptyFrame = parent.document.getElementById('emptyFrame');
    emptyFrame.parentNode.removeChild(emptyFrame);
    emptyFrame.src = 'http://www.google.co.in';
    alert(emptyFrame);
    }
    </script>
    </head>
    
    <body>
    <input type="button" name="ClickMe" onclick="destroy()" value="Click Me"/>
    </body>
    If i didn't call removeChild then i could set the src property but if i deleted then i couldn't set the src property. But still i m having the frame reference .. why it's not getting tottaly wiped out .... ?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Set it to null.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Then should i be destroying it by calling removeChild anymore ? I think no ... ;)

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Sorry what i silly comments i passed ... Sorry!!
        Actually i need to destroy ..just to dereference the variable i need set it to null :P

        Comment

        Working...